Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

12tqian's blog

By 12tqian, history, 6 years ago, In English

Hello,

On 703C, I keep getting a weird error on test case 3. I know why the code outputs the wrong answer, but I don't know why I would get an error. When I run the code on Code Blocks, after copying the first line of input, the console window just closes automatically. Can somebody point out where my code goes makes an error (I'm not talking about solving the problem, I just want to know what the syntax error is)? Thanks!

Code: http://codeforces.com/contest/703/submission/40296193

Problem: http://codeforces.com/contest/703/problem/C

-12tqian

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
6 years ago, # |
Rev. 2   Vote: I like it +3 Vote: I do not like it

1) Your solution doesn't read entire input file (because of break). That usually gives strange errors such as this, so don't do this. Removing break fixs error.
2) That also provides closing your window in codeblocks — you don't read anything but the first line in input, that's why it's closing.

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

    Thanks! I forgot that I never finished reading the data when I broke out of the while loop.

»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

?detaR tI sI