IdeaMonk

thoughts, ideas, code and other things...

Tuesday, July 29, 2008

Gully Cricket poster

Labels: ,

Monday, July 28, 2008

Table Tennis selection poster

Labels: ,

Basketball selection trials poster











Labels: ,

Sunday, July 20, 2008

Badminton Match Poster

Labels: ,

Wednesday, July 09, 2008

SPOJ PALIN

  1. #include <iostream>  
  2. #include <vector>  
  3. using namespace std;  
  4.   
  5. bool compare(vector<int> n1,vector<int> n2,int half){  
  6.  // if n1>n2 for problem size(n1) == size(n2)  
  7.  for (int i=n1.size()-1;i>=half;i--){  
  8.   if (n1[i]!=n2[i])  
  9.    return n1[i]>n2[i];  
  10.  }  
  11.  return false;  
  12. }  
  13.   
  14. void work(vector<int>& num, int pos1, int pos2) {  
  15.  if (pos1 < 0) {  
  16.   num[num.size()-1] = 1;  
  17.   num.insert(num.begin(), 1);  
  18.   return;  
  19.   } else   
  20.  if (num[pos1] < 9) {  
  21.         num[pos1] = num[pos2] = num[pos1] + 1;  
  22.         return;  
  23.     } else {  
  24.        num[pos1] = num[pos2] = 0;  
  25.         work(num, pos1-1, pos2+1);  
  26.         return;  
  27.    }  
  28. }  
  29.   
  30. main (){  
  31.  char n;  
  32.  vector<int> num,old;  
  33.  int half,ssize;  
  34.    
  35.  n=getc(stdin);  
  36.  while (n!='\n'){  
  37.   num.push_back(n-'0');  
  38.   n=getc(stdin);  
  39.  }  
  40.  while (num.size()>=1 && num[0]!=0){  
  41.   old = num;  
  42.   ssize=num.size();  
  43.   if (ssize%2==0){  
  44.    //even  
  45.    half=ssize/2;  
  46.    //mirror into vector  
  47.    for (int i=0;i<half;i++){  
  48.     num[ssize-1-i]=num[i];  
  49.    }  
  50.    if (compare(num,old,half)){  
  51.     for (int i=0;i<ssize;i++){  
  52.      printf ("%d",num[i]);  
  53.     }  
  54.     printf ("\n");  
  55.    } else {  
  56.     work (num,half-1,half);  
  57.     ssize=num.size();  
  58.     for (int i=0;i<ssize;i++){  
  59.      printf ("%d",num[i]);  
  60.     }  
  61.     printf ("\n");  
  62.    }  
  63.   } else {  
  64.    //odd  
  65.    half=ssize/2 ;  
  66.    //mirror into vector  
  67.    for (int i=0;i<half;i++){  
  68.     num[ssize-1-i]=num[i];  
  69.    }  
  70.    if (compare(num,old,half)){  
  71.     for (int i=0;i<ssize;i++){  
  72.      printf ("%d",num[i]);  
  73.     }  
  74.     printf ("\n");  
  75.    } else {  
  76.     work (num,half,half);  
  77.     ssize=num.size();  
  78.     for (int i=0;i<ssize;i++){  
  79.      printf ("%d",num[i]);  
  80.     }  
  81.     printf ("\n");  
  82.    }  
  83.   }  
  84.   num.clear();  
  85.   n=getc(stdin);  
  86.   while (n!='\n'){  
  87.    num.push_back(n-'0');  
  88.    n=getc(stdin);  
  89.   }  
  90.  }  
  91. }  
Don't start smiling at the code above, thinking that you've got the solution!
The problem with the above is that its a TLE for SPOJ. If you can spot or fix the problem with the code, the points are free for you to grab. And if you are a little benevolent then do consider hinting me too on the shortcomings of this problem.
Adios

Labels: ,

Saturday, July 05, 2008

TumTube's Logo Design



























Just finished the design of TumTube's logo. TumTube is going to be a major Indian video sharing website. A lot of improvement is going to be implemented to add social features and engage users to its exclusive contents.
Click here to checkout this piece of work in action.

Labels: ,