Блог пользователя 12tqian

Автор 12tqian, история, 6 лет назад, По-английски

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://mirror.codeforces.com/contest/703/submission/40296193

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

-12tqian

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
6 лет назад, # |
Rev. 2   Проголосовать: нравится +3 Проголосовать: не нравится

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 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

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

»
6 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

?detaR tI sI