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

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

Hi, I just began using Python 3.6.1 for Codeforces problems. Codeforces allows us to submit code in Python 3.5.2, so I wonder if my solutions in 3.6.1 might still get accepted. I solved this easy problem: http://codeforces.com/gym/101341/problem/M
Please, tell me what I'm doing wrong, here is my code (which runs well on my computer, but gets runtime error when I submit): https://pastebin.com/NPs7HbkK

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

»
7 лет назад, # |
Rev. 4   Проголосовать: нравится 0 Проголосовать: не нравится
  1. Main problem is in your input. int(input()) reads line, but if you want to read multiple numbers in one line for Python 3.x you can use that:
v = [int(x) for x in input().split(' ')]

2. Again, don't use " " in Python, use ' ' instead.

Check AC submission here: http://codeforces.com/gym/101341/submission/28311885

UPD: seems you can't see submission until you didn't solve it, here is pastebin link: https://pastebin.com/Lf2NbKnw