Q: Where are the input and the output?

A: Your program shall always read input from stdin (Standard Input) and write output to stdout (Standard Output). For example, you can use 'scanf' in C or 'cin' in C++ to read from stdin, and use '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 get a ¡®Runtime Error¡¯ or a ¡®Wrong Answer¡¯ if you try to do so.

¡¡

Here is a sample solution for problem 1000 using C++/G++:

#include <iostream>

 using namespace std;

int  main()

{

    int a,b;

    cin >> a >> b;

    cout << a+b << endl;

    return 0;

}

It's important that the return type of main() must be int when you use G++/GCC,or you may get compile error.

Here is a sample solution for problem 1000 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 for problem 1000 using PASCAL:

program p1000(Input,Output);

var

  a,b:Integer;

begin

   Readln(a,b);

   Writeln(a+b);

end.

¡¡

Here is a sample solution for problem 1000 using JAVA:

Now java compiler is jdk 1.5, next is program for 1000

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 program?

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

Q: Can I use shortcut key when submitting?

A: Here are shortcut keys defined in the submit page

ALT+s    :Submit button

ALT+u    :User id field , if you haven't login.

ALT+l    :Language Option

ALT+p    :Problem Id filed

¡¡

¡¡

Q: What is the meaning of the judge's replies?

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

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

Accepted: OK! Your program is correct!

Presentation Error: 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: Correct solution not reached for the inputs. The inputs and outputs that we use to test the programs are not public (it is recommendable to get accustomed to a true contest dynamic ;-).

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

Time Limit Exceeded: Your program tried to run during too much time.

Now each problem have two time limit--TOTAL TIME LIMIT and CASE TIME LIMIT. When JudgeOnline run your program ,it redirect your program's standard input to input file, then you can just read from standard input. And one problem may have several input files, when your program finished one input file and produce the correct output,  JudgeOnline then restart your program to deal with next input file. Each input file's format is exactly as the problem's input specification. Case time limit is the maximum time your program is allowed to use for each input file, and TOTAL TIME LIMIT is the maximum time for you to pass all input file. If your program exceed any one of this two time limit, you will receive time limit exceed.

As most problems only have one or two input file (of course, also one or two output file), then the CASE TIME LIMIT is trivial then it will be set equal to TOTAL TIME LIMIT and the problem description will not display CASE TIME LIMIT.

So when you got time limit exceed, but you find the time your program used is much less than TOTAL TIME LIMIT----your program must exceed CASE TIME LIMIT.

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

Output Limit Exceeded: Your program tried to write too much information. This usually occurs if it goes into a infinite loop. Currently the output limit is 2*answer file¡¯s size.

Compile Error: The compiler could not compile your program. Of course, warning messages are not error messages. Click the link at the judge reply to see the actual error message.

No such problem: Either you have submitted a wrong problem id or the problem is unavailable.