新改版的ACM网站不再兼容 IE6、IE7、IE8，推荐使用 Chrome浏览器
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 1 using C++/G++:
Here is a sample solution for problem 1 using C/GCC:
Here is a sample solution for problem 1 using JAVA(jdk1.5):
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.
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.
cin >> n;
while(scanf("%d", &n) != EOF)
while (cin >> n)