Trivia

From programming_contest
Jump to: navigation, 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.

<math> 2 + 2 \sqrt{2}</math>

  1. import java.util.*;
  2. public class c {
  3.  
  4. 	/**
  5. 	 * @param args
  6. 	 */
  7. 	Scanner in=new Scanner(System.in);
  8. 	public static void main(String[] args) {
  9. 		c noob=new c();
  10. 		noob.go();
  11.  
  12. 	}
  13. 	private void go() {
  14. 		in.nextInt();
  15. 		int c=0;
  16. 		while(in.hasNextInt()){
  17. 			c++;
  18. 			int p=in.nextInt();
  19. 			ArrayList<Queue<Integer>> al=new ArrayList<Queue<Integer>>();
  20. 			for(int i=0;i<p;i++){
  21. 				al.add(new LinkedList<Integer>());
  22. 			}
  23. 			for(int i=0;i<52;i++){
  24. 				al.get(0).offer(in.nextInt()%13);
  25. 			}
  26. 			int[] count=new int[p];
  27. 			int[] last=new int[p];
  28. 			for(int i=0;i<100000;i++){
  29. 				for(int j=p-1;j>=0;j--){
  30. 					if(al.get(j).size()==0)continue;
  31. 					count[j]=(count[j]+1)%13;
  32. 					int t=al.get(j).poll();
  33. 					if(count[j]==t){
  34. 						if(j!=p-1){
  35. 							al.get(j+1).offer(t);
  36. 						}
  37. 						if(al.get(j).size()==0){
  38. 							if(t==0)t=13;
  39. 							if(j==0){
  40. 								last[j]=t;
  41. 							}else{
  42. 								if(last[j-1]!=0)last[j]=t;
  43. 							}
  44. 						}
  45. 					}
  46. 				}
  47. 			}
  48. 			boolean works=true;
  49. 			for(int i:last){
  50. 				if(i==0)works=false;
  51. 			}
  52. 			System.out.print("Case "+c+":");
  53. 			if(works){
  54. 				for(int i:last){
  55. 					System.out.print(" "+i);
  56. 			        }
  57. 			}else{
  58. 				System.out.print(" unwinnable");
  59. 			}
  60. 			System.out.println();
  61. 		}
  62. 	}
  63.  
  64. }