Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Useful tip for the upcoming Hacker Cup

Правка en1, от Nathan4, 2024-10-02 10:00:41
Why am I writing this

Here's two pretty useful command lines which run your code on local .txt files and write the results as .txt files (This is the input and output format required by the upcoming Hacker Cup!):

After you have your solution ready, first run the following in your terminal (I'm using vscode), be sure that you are in the same directory as your code:

g++ -o [output executable file name] [code file]

For example, when I am solving problem A, I will run:

g++ -o a a.cpp

After this, your terminal should return nothing and work fine. This first line compiles the code for you. Next, you can directly run the Executable with Input/Output redirection:

./[name of your executable file name] < [name of input txt file] > [name of output txt file]

So for the previous example, I will then run:

./a < ain.txt > aout.txt

Be sure that the input txt file's directory is also correct, and you should see aout.txt appearing in the same folder as your code file, and the results lie inside.

Hope that no one will be stuck in this step again for the first round, and wish all of u good luck (I didn't notice any written tutorial about this, but feel free to link other good ones :D)

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Nathan4 2024-10-02 10:00:41 1898 Initial revision (published)