Solution when you do not know how many times python input() should be done

Asked 2 years ago, Updated 2 years ago, 20 views

When solving the problem with the atcoder, there are times when I don't know the number of standard inputs, so please let me know how to write it in python.If this question is not appropriate, please let me know.
atcoder abc 147c

python

2022-09-30 19:21

1 Answers

Quoted by SO:

Use file.read.

input_str=sys.stdin.read()
https://stackoverflow.com/questions/21235855/how-to-read-user-input-until-eof/36237166

You may want to create a file for input and pass it over to the redirect to verify its operation.

Many programming contests, including AtCoder, allow you to determine the number of lines of input.For example:

x_{11}y_{11}
x_{12}y_{12}
x_{13}y_{13}

x_{21}y_{21}
x_{22}y_{22}

This concludes the entry.Do you see that the last x_{22}y_{22} corresponds to x_{NA_{N}}y_{NA_{N}}?


2022-09-30 19:21

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.