LECANDY Problem facing issues

Hello everyone, I am new to codechef and started solving the problems yesterday itself. I came across this this problem and I am unable to solve it. Can someone help me figure out why I keep getting wrong answer.
Here is the link to the solution : https://www.codechef.com/viewsolution/26885837

Sorry what’s the question link?

In your solution, you forgot to reset sum to 0 when a new testcase starts. So sum of new cases add to that of previous cases which gives a wrong answer.

Thanks a lot mate. Spent hours figuring out what was wrong.

1 Like


1 Like

It is smart solution , good luck.