WarpSpeed's blog

By WarpSpeed, history, 3 years ago, In English,

This is a very strange incident. And I'll not be exaggerating when I say this but, I truly am bewildered by it.

While solving the following question : http://codeforces.com/problemset/problem/614/A

I got a WA on Test case 39. When I decided to run the same code on Ideone, this is what I found:

Case 1 : I run the code as it as : http://ideone.com/MLGW4I

Case 2 : I add an additional printf statement, leaving the entire remaining code unchanged. : http://ideone.com/X9kngM

The change can be seen (addition of an extra printf statement) in line no. 31 of the code.

How can it be possible that a simple printf statement changes the output that follows, when nothing is changed anywhere else? Or is it some pretty big blunder that I'm making and am completely unaware of it?

Any help regarding this will be much appreciated.

 
 
 
 
  • Vote: I like it  
  • +6
  • Vote: I do not like it  

»
3 years ago, # |
  Vote: I like it +1 Vote: I do not like it
  • »
    »
    3 years ago, # ^ |
      Vote: I like it +6 Vote: I do not like it

    I am blown away by this. I wonder, how on the earth could I've even thought if anything like this could ever exist. Thanks a lot! :)