Please help me in Chef and his Students

Here is my attempt at Chef and his Students.https://www.codechef.com/viewsolution/15334075
The output seems correct to me.Please tell me why i am getting WA.Thanks.

Firstly-

start:for(i=0;i<10001;i++)

You are missing a 0 here, You are running upto {10}^{4}+1 isntead of {10}^{5}+1.

Secondly, your input method isnt the best. I wouldnt rely on setter remembering to put a newline after the last string (if setter doesnt put newline after last string, your code prints wrong answer for that TC). Try if switching your input method gets you an AC.

Thanks a lot.I got AC after doing i<100001

Did you changed your input method as well?

@kriskhundu you can accept the answer as a right solution

1 Like