Answer the question
In order to leave comments, you need to log in
How to read input data in python on russian code cup?
Good afternoon.
I tried my hand at RCC, but all my attempts crashed against the compiler.
Written, accepts via stdin and waits for a response via stdout
I tested my programs with the command python main.py < test.txt
Everything works.
I upload for verification, crashes with an error: Программа завершилась с ненулевым чего-там.
I read stdin like this:
What am I doing wrong? lines = [line.rstrip('\n') for line in sys.stdin]
Answer the question
In order to leave comments, you need to log in
Are you sure the input is the problem? Crashes in the first test? I did not participate in RCC, but in Yandex Algorithm I read the data like this:
p = []
n = int(input())
for i in range(n):
x, y = input().split()
x, y = int(x), int(y)
p.append((x, y))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question