• Loading...


0-28:0-21
Accepted
1

View Plain Text

  1. int f1,p;
  2. int f(int n)
  3. {
  4.   if(n==0)
  5.     return f1;
  6.   p=f(n-1);
  7.   if(p>=10000)
  8.     return p%10000;
  9.   else if(p<10000 && p%2==0)
  10.     return 2*p+5;
  11.   else if(p<10000 && p%2!=0)
  12.     return p+3;
  13. }
  14.  
  15. main()
  16. {
  17.   int n,t,a[20],i=0,j=0;
  18.   label1:scanf("%d",&t);
  19.   if( t>=20 || t<=0) goto label1;
  20.   while(t>0)
  21.   {
  22.     label2:scanf("%d %d",&n,&f1);
  23.            if( n<0 || n>1000000 || f1<0 || f1>1000000000) goto label2;
  24.            t--;
  25.            a[i]=f(n);
  26.            i++;
  27.   }
  28.   while(i>0)
  29.   {
  30.     printf("%d\n",a[j]);
  31.     i--;
  32.     j++;
  33.   }
  34.   return 0;
  35. }
  36.  


List of Keywords used
    None


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