• Loading...


0-31:0-1
Time Limit Exceeded
0

View Plain Text

  1. o,t,s,n;
  2. f(n)
  3. {
  4.         if(n==0)
  5.                 return o;
  6.         //(f(n-1)>10000 || f(n-1)==10000)?(f(n)=f(n-1)%10000):((f(n-1)%2==0)?(f(n)=2*f(n-1)+5):(f(n)=f(n-1)+3));
  7.         else if(f(n-1)>10000 || f(n-1)==10000)
  8.                 return f(n-1)%10000;
  9.         else if(f(n-1)%2==0)
  10.                 return 2*f(n-1)+5;
  11.         else
  12.                 return f(n-1)+3;
  13. }
  14.        
  15. main()
  16. {
  17.         scanf("%d",&t);
  18.         while(t--)
  19.         {
  20.                 scanf("%d %d",&n,&o);
  21.                 s=f(n);
  22.                 printf("%d\n",s);
  23.         }
  24. }



Trial 1
Trial 2
Trial 3
Trial 4
Submissions
Multipurpose
1000 pt
You are not logged in
0 / 170

Datatype
1000 pt
You are not logged in
0 / 308

No Bitwise
1000 pt
You are not logged in
0 / 78

Cuboid
1000 pt
You are not logged in
0 / 166

Evaluate the function
1000 pt
You are not logged in
0 / 94

Largest in the set
1000 pt
You are not logged in
0 / 69

2 to N
1000 pt
You are not logged in
0 / 144