Hello I’m new to USACO, and I’m using the training website in China.
For questions like milking cows and beads, I can understand the question and the solutions online that I’ve searched, except for the parts where they analyze the input.
Is there some quick and easy way for reading the input in stdin with python?
As an example, the input below is needed:
500
200
200
0
Suggest that 500 is the number of apples I bought, let it be n
200 and 200 is the number of apples each of two my friends ate, let them be y[0] and y[1]
0 is how much I ate, let it be x
The question asks for how many apples are left.
The algorithm for this is quite easy,
I mean, normally it would be:
y = []
n = int(input())
for i in range(2):
y[i] = int(input())
x = int(input())
(it could be shortened)
How is this done in stdin fashion?