ENIGMA_breaker's blog

By ENIGMA_breaker, history, 3 years ago, In English

Hi! I am practicing for USACO, and I have some questions. I have never done USACO before, but I am totally excited. What is the input/output for USACO? I am a python programmer, and I have tried doing a USACO problem from a past year, and there is issues with the inputs and outputs. Thanks!

  • Vote: I like it
  • +11
  • Vote: I do not like it

»
3 years ago, # |
Rev. 2   Vote: I like it +21 Vote: I do not like it

Older USACO contests use file input/output instead of stdin and stdout.

fin = open("problemname.in", "r")
fout = open("problemname.out", "w")

The rest is similar to stdin and stdout, use fin.readline() and fout.write() iirc.

Edit: forgot to mention USACO contests after December 2020 should use standard input/output.