CHEFLR wrong answer

I have tried several things, still the following code is giving wrong answer. It works perfectly in ideone and my computer.

Oh great! It was exactly the mistake I was making during the contest but I realized it after a few WAs. The click here is that if your answer overflows 10^9 + 7 at some iteration of the program, then if the value after the condition was supposed to be even, then after mod, it would become odd. (Even mod odd = odd). Just add another variable level (initialized to 1). And after each iteration increment it. It will give AC.

My Code that gave WA:

Slight Modification which gave AC:


thanks it worked!

1 Like

I was stuck the same way.

@ayushi_jha : Your welcome :slight_smile:

I was also stuck the same way. Thanks

1 Like