Wrong answer in Tricky remainder problem MOTU001

it’s my first contest and here are my submissions can anyone tell me what is wrong in them.

In for loop you are using the condition i<=0, the loop would not be executed unless c is smaller than or equal to zero. Hope this helps.

2 Likes

So, as the problem itself says that the problem cannot be done with a loop as the constraint are very large so it is going to give TLE if we are using the loop so instead we have to go with a simpler approach which is mathematics.
you can see the answer from the link.
https://www.codechef.com/viewsolution/31889520
@shiwach

2 Likes

yes that one was submitted by mistake

1 Like

understood,Thank you

1 Like