I need to read test cases in the following format:
3 1 2 3
4 52 2 1 87
10 51 32 1 36 21 34 32 12 34 45
200 (... 200 numeros separados por espaço)
and so on, where the first number indicates the number of numbers to come later. Each line is a test case, so I would like to read each one up to the line break, how can I do this?
I know the line break is indicated by a '\ n', but how can I go through this input string per line?
Edit: I think I was able to resolve with
import sys
while line:
line = sys.stdin.readline()
[operacoes em cada linha]