Frequently Asked Questions

About :

如果发现网站有Bug,或是有好的建议,请联系QQ:948117012,或者在Web Board中发帖留言。

新改版的ACM网站不再兼容 IE6、IE7、IE8,推荐使用 Chrome浏览器

如使用类似360浏览器等双核浏览器,请选择 极速模式

9楼上机的同学请使用 百度影音浏览器

Question : Where are the input and the output?

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++:

#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 1 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 1 using JAVA(jdk1.5):

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); } }
Question : How to submit java program?

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.

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

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.

Question : 一组输入和多组输入

Language C C++
一组输入: int n;
scanf("%d", &n);
  ...
int n;
cin >> n;
  ...
有多组输入
每组输入一个数:
int n;
while(scanf("%d", &n) != EOF)
{
  ...
}
int n;
while (cin >> n)
{
  ...
}

具体训练可以参考Problem:730-737