LightOJ 1020 – A Childhood Game

Problem:-http://lightoj.com/volume_showproblem.php?problem=1020


Solution 
:-

  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5.     long n,t,no=0;
  6.     char s[7];
  7.     scanf(“%ld”,&t);
  8.     while(t)
  9.     {
  10.         scanf(“%ld%s”,&n,s);
  11.         if(strcmp(s,“Alice”)==0)
  12.         {
  13.             if(n%3==1)
  14.             printf(“Case %d: Bobn,++no);
  15.             else
  16.             printf(“Case %d: Alicen,++no);
  17.         }
  18.         else
  19.         {
  20.             if(n%3==0)
  21.             printf(“Case %d: Alicen,++no);
  22.             else
  23.             printf(“Case %d: Bobn,++no);
  24.         }
  25.     }
  26.     return 0;
  27. }
At First you can try to solve this problem if you can’t than see this code & find what’s your problem . If you copy paste this code you could not improve yourself in programming .

Posted by Shipu Ahamed

1 comment

i think some hints should be given . not the code .so that we can think more.

Leave a Reply