Showing posts with label C++. Show all posts
Showing posts with label C++. Show all posts

2008-01-18

Monkey And Peach

On The Beach Has Pile Of Peach , Five Monkeys Divide. The First Monkey Divides Into Equally This Pile Of Peach Five , But More Than A Peach ,This Monkey Throws Away Much One Into The Sea ,Having Taken One Portion Of Five Peach Away .The Second Monkey Equally Divides Into The Peach Five Which Is Left Over , Also More Than A Peach , It Has Thrown Away Much One Into The Sea , Took Away One Portion ,Similarly . The Third , The Fourth , The Fifth Monkey Are All Done By Such . Question , How Many Peach On The Beach Most Little Has In Originally ?

main( )
{
 int i,m,j,k,count;
 for(i=4;i<10000;i+=4)
 {
  count=0;
  m=i;
  for(k=0;k<5;k++)
   {
     j=i/4*5+1;
     i=j;
     if(j%4==0)
     count++;
     else
     break;
   }
  i=m;
  if(count==4)
   {
    printf("%d\n",count);
     break;
   }
 }
}

2008-01-09

Interesting Decode

main(_){ for ( --_ ; putchar( _++["J!Mpwf!Zpv\1"] - 1 ) ; ) ; }

Program : Prints "I Love You"
//Not Including The Quotation Marks
//File Name : xx.c
//Programming Language : C
//Author : Unknown
//This Program Simply Prints "I Love You" And Exits.

This Lets Me Remember A Story Of About Mathematics : Mathematician Descartes In Writes Letter For Sweden Princess Christina , Has Only A Formula " R=A(1-Sinθ) " .
He-He , With Polar Coordinate System A Beautiful Heart Shape Line .
It's A Good Idea .