Submission
In each task, you must submit one source file that contains the complete source code of your program. See below for some examples of what this means in practice.
After the submission, your code will be compiled and tested on the server. Your program must read from the standard input and write to the standard output.
Your code will be accepted, if it solves each test correctly within given time and memory limits.
C++ example
Assume that your task is to read one integer and output the integer , for . Here is an example of how to solve it with C++:
#include <iostream> using namespace std; int main() { int i; cin >> i; cout << i + 1 << "\n"; }
If the source code is in file example.cc
, you should be able to compile the program on a typical Linux computer by running:
g++ -std=c++11 -O2 -Wall example.cc -o example
and then test it by running:
./example < input > output
If the file input
contains one line with the integer 123
, you should have in the file output
one line with the integer 124
.
Java example
Here is an example of how to solve the same problem with Java:
import java.util.Scanner; public class Example { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int i = scan.nextInt(); System.out.println(i+1); } }
Save the source code in Example.java
, compile with javac Example.java
and test by running:
java Example < input > output
Python example
Finally, here is a Python implementation of the same task.
i = int(input()) print(i+1)
Save the source code in example.py
and test by running:
python3 example.py < input > output