http://www.codechef.com/viewsolution/5546716-this solution gives me WA but on replacing scanf("%d",&t) with ’ int v;char t[320];
gets(t);
v=atoi(t);’ I got CA.
Also http://www.codechef.com/viewsolution/5546968 is giving TLE though this seems to be a faster solution to me
I think so problem is with atoi(), and btw int cannot store a number with length 314 decimal numbers also you are declaring array of int datatype and storing characters in it.
I might be wrong…
Go through this Link : http://stackoverflow.com/questions/7785106/atoi-function-in-c-not-working-properly
nice link thanks
but the length of t is not 314 is it?
then why the problem?
Okay i am sorry i am unable to figure it out the reason for TLE but for the code you are getting WA i got the bug.
while taking integer input ‘\n’ is left in buffer and when you take input in str variable ‘\n’ is stored instead of he actual string, Thus you have to take ‘\n’ as dump input as so use getchar() after scanf() and you’l receive AC.
Just check this AC link i have submitted using your code by adding getchar():
thank u so much!
welcome…