Wrong Answer

http://www.codechef.com/viewsolution/4347904
in codechef,it says wrong answer for this code although code is working im ny compiler.

You need to print your answer as per the sample output . Notice that after printing the answer for each testcase you are not going to a new line . So change printf("%lld",max) to printf("%lld\n",max) .

Also max is declared as an unsigned int but you are using “%lld” specifier to print it which is used for long long ints . So change unsigned int max to long long max

2 Likes

There are two mistakes in your code.

  1. You declared ‘max’ as ‘unsigned int’ but used ‘%lld’ in printf
  2. You need to print a new line after each output

After making corrections here is your accepted code: http://www.codechef.com/viewsolution/4347939

1 Like

Thanks a lot! I had already spotted the ‘unsigned int’ error. It was the \n that was giving the problem. Finally it worked!

Thanks a lot! I had already spotted the ‘unsigned int’ error. It was the \n that was giving the problem. Finally it worked!

//