FAQs

 

Q: What does my program input from and output to?

A: Your program shall always input from stdin (Standard Input) and output to stdout (Standard Output). For example, you use scanf in C or cin in C++ to read from stdin, and printf in C or cout in C++ to write to stdout.

User programs are not allowed to open and read from/write to files. You will probably get a `Runtime Error¨ or `Wrong Answer¨ if you try to do so.

 

Input/output of scanf is faster than cin.

 

Here is a sample solution for problem 10000 using G++:

#include <iostream>

using namespace std;

int main()

{

    int a, b;

    cin >> a >> b;

    cout << a + b << endl;

    return 0;

}

 

If you use long long in your gcc/g++ program, make sure you use %I64d instead of %lld when read or write long long value.  (Maybe it's a bug of mingw gcc.)

 

Please note that the return type of main() must be int when you use G++/GCC, or else you may get Compile Error.

and all solution should return 0 or else you will get Runtime Error.

Just as follow c solution for 10000(An easy problem a+b):

#include <stdio.h>

int main()

{

    int a, b;

    scanf("%d %d", &a, &b);

    printf("%d\n", a + b);

    /*return 0*/ Your should return 0. and this isn't same for G++, because 0 will be set as G++ complier for default return value.

}

 

Here is a sample solution to problem 10000 using C/GCC:

#include <stdio.h>

int main()

{

    int a, b;

    scanf("%d %d", &a, &b);

    printf("%d\n", a + b);

    return 0;

}

 

Here is a sample solution to problem 10000 using PASCAL:

program p1000(Input, Output);

var

  a, b:Integer;

begin

   Readln(a, b);

   Writeln(a + b);

end.

 

Here is a sample solution to problem 10000 using JAVA:

Now the Java compiler is jdk 1.5, below is a program for problem 10000

import java.io.*;
import java.util.*;
public class Main
{
    public static void main(String args[]) throws Exception
    {
        Scanner cin=new Scanner(System.in);
        int a = cin.nextInt(), b = cin.nextInt();
        System.out.println(a + b);
    }
}

 

 

Old program for jdk 1.4

 

import java.io.*;
import java.util.*;

public class Main
{
    public static void main (String args[]) throws Exception
    {
        BufferedReader stdin =
            new BufferedReader(
                new InputStreamReader(System.in));

        String line = stdin.readLine();
        StringTokenizer st = new StringTokenizer(line);
        int a = Integer.parseInt(st.nextToken());
        int b = Integer.parseInt(st.nextToken());
        System.out.println(a + b);
    }
}

 

Q: How to submit Java programs?

A: Java programs submitted must be in a single source code (not .class) file.  They must also read from standard input and write to standard output, as in the other languages. All programs must begin in a static method named main in a class named Main. However, you can implement and instance as many classes as needed.

 

Q: What are the meanings of the judge's replies?

A: Here is a list of the judge's replies and their meanings:

Waiting: The judge is so busy that it can't judge your submission at the moment. Usually you just need to wait a minute and your submission will be judged.

Accepted (AC): Congratulations! Your program is correct!

Presentation Error (PE): Your output format is not exactly the same as the judge's output, although your answer to the problem is correct. Check your output for spaces, blank lines, etc. against the problem output specification.

Wrong Answer (WA): Expected output not reached for the input. The input and output data that we use to test the programs are not public (it is recommendable to get accustomed to a true contest dynamic ;-).

Runtime Error (RE): Your program failed during the execution (illegal file access, stack overflow, pointer reference out of range, floating point exception, division by zero...).

Time Limit Exceeded (TLE): Your program tried to run for too much time.

Memory Limit Exceeded (MLE): Your program tried to use more memory than the judge default settings.

Output Limit Exceeded (OLE): Your program tried to output too much. This usually occurs when your program goes into an infinite loop. Currently the output limit is twice the standard output file¨s size ,default as 10KB.

Compile Error (CE): The compiler could not compile your program. Warning messages are not considered errors. Click on the link at the judge's reply to see the actual error messages.

 

Q: What are the meanings of time limit and special time limit in the problem?

A: For some language'solution like Java the speed is much more slow than C/C++ or Pascal solutions, so it's processed by the special time limit.