1 / 8
Dec 2012

This one's for Problem code: "AP2" and problem no. 11063
Problem is an easy one.
I dont know why the judge is giving WA in this code.

Yeah!! Finally its A.C.
Thnx to daft_wullie. 8) 
He opened my eyes.. :shock:

Is there any problem with constraints ??
Because i know the code is giving right output.
Plz help me out as i am new in spoj and not familiar with constraints. How can i apply them ??

  • created

    Dec '12
  • last reply

    Dec '12
  • 7

    replies

  • 160

    views

  • 3

    users

  • 1

    link

I'm not an expert for c(++) programming, so I won't comment on your code too much. wink Generally you should look for constraints and suitable data types in

  • problem statement
  • problem comments
  • forum (use the search engine)

Here I'm not sure if you used long long data type. The comments show some tricky test cases.
Good luck.
Daft

I looked in comments and in forum, but i was not able to find the mistake....
there were no tricky cases....
plz provide some.

2
144115188075855890 144115188075856304 7349874591868660947
144115188075856304 144115188075855890 7349874591868660947

[/quote]

On IDEONE.com, your code does not pass this test case.

Sorry !! blush
Now i got the mistake !! bulb

Now it passed.. smiley
Thanx for ur help daft_wullie.. 8)

#include<stdio.h>
int main()
{
      int t,n,i;
      scanf("%d",&t);
      while(t>0)
      {
                int s=0;
                scanf("%d",&n);
                for(i=n;i>0;i--)
                {
                                s+=(n-i+1)*i*i*i;
                                if(s>1000000003)
                                s=s%1000000003;
                }
                printf("%d\n",s);
                t--;
      }
      return 0;
}

Pls help!!