Codeforces problem wrong answer

This is a link to my submission. I think my approach is correct and the answer is also correct.
But I am getting wrong answer on test 5. Plz help.

I don’t know how you arrived at your solution, but it doesn’t look to be correct. I think you don’t know about the % ( modulo ) operator. See how that can help here.

It’s better if you solve it yourself, otherwise you can look at the tutorial.

1 Like