Trivia

From programming_contest
Jump to navigation Jump to search

Trivias on anything

Trivia on ICPC

2014 Regional

Professor Astrachan asked us to write a report full of emotional activities after the regional contest.

Stand back, I am throwing emotion !

Fun Stuff

Fun Comments in Code

  • I have found couple funny comments in surfing the web. Let me know which one's your fav.

I am particularly guilty of this, embedding non-constructive comments, code poetry and little jokes into most of my projects (although I usually have enough sense to remove anything directly offensive before releasing the code). Here's one I'm particulary fond of, placed far, far down a poorly-designed 'God Object':

/**

  • For the brave souls who get this far: You are the chosen ones,
  • the valiant knights of programming who toil away, without rest,
  • fixing our most awful code. To you, true saviors, kings of men,
  • I say this: never gonna give you up, never gonna let you down,
  • never gonna run around and desert you. Never gonna make you cry,
  • never gonna say goodbye. Never gonna tell a lie and hurt you.
  • /

I'M SORRY!!!! I just couldn't help myself.....!


  • And another, which I'll admit I haven't actually released into the wild, even though I am very tempted to do so in one of my less intuitive classes:

//

// Dear maintainer:

// Once you are done trying to 'optimize' this routine,

// and have realized what a terrible mistake that was,

// please increment the following counter as a warning

// to the next guy:


// total_hours_wasted_here = 42

//


  • This one is quite funny

Exception up = new Exception("Something is really wrong."); throw up; //ha ha


  • Also check out this

//When I wrote this, only God and I understood what I was doing //Now, God only knows


  • lol:

stop(); // Hammertime!


  • This seems to stop morons from messing my code...

// Autogenerated, do not edit. All changes will be undone.


  • Lol such a win

// sometimes I believe compiler ignores all my comments


  • Fun stuff

// somedev1 - 6/7/02 Adding temporary tracking of Login screen

// somedev2 - 5/22/07 Temporary my ass


  • And my all time favorite

// drunk, fix later

Wish I were kidding. And knowing the developer who wrote the code, I think he meant it literally.

2+22

import java.util.*;
public class c {

	/**
	 * @param args
	 */
	Scanner in=new Scanner(System.in);
	public static void main(String[] args) {
		c noob=new c();
		noob.go();

	}
	private void go() {
		in.nextInt();
		int c=0;
		while(in.hasNextInt()){
			c++;
			int p=in.nextInt();
			ArrayList<Queue<Integer>> al=new ArrayList<Queue<Integer>>();
			for(int i=0;i<p;i++){
				al.add(new LinkedList<Integer>());
			}
			for(int i=0;i<52;i++){
				al.get(0).offer(in.nextInt()%13);
			}
			int[] count=new int[p];
			int[] last=new int[p];
			for(int i=0;i<100000;i++){
				for(int j=p-1;j>=0;j--){
					if(al.get(j).size()==0)continue;
					count[j]=(count[j]+1)%13;
					int t=al.get(j).poll();
					if(count[j]==t){
						if(j!=p-1){
							al.get(j+1).offer(t);
						}
						if(al.get(j).size()==0){
							if(t==0)t=13;
							if(j==0){
								last[j]=t;
							}else{
								if(last[j-1]!=0)last[j]=t;
							}
						}
					}
				}
			}
			boolean works=true;
			for(int i:last){
				if(i==0)works=false;
			}
			System.out.print("Case "+c+":");
			if(works){
				for(int i:last){
					System.out.print(" "+i);
			        }
			}else{
				System.out.print(" unwinnable");
			}
			System.out.println();
		}
	}

}