
|
Frequently Asked Questions
Q:What is the compiler the judge is using and what are the compiler options? A:The online judge system is running on Linux. We are using GNU GCC/G++ for C/C++, Free Pascal for Pascal and Sun JDK 1.6 for Java. The compile options are: C: gcc foo.c -o foo -ansi -fno-asm -O2 -Wall -lm --static -DONLINE_JUDGE C++: g++ foo.c -o foo -ansi -fno-asm -O2 -Wall -lm --static -DONLINE_JUDGE Free Pascal(FPC): fpc -Sd -O2 -Op2 -dONLINE_JUDGE Java: No special options Our compiler software version: gcc/g++ (GCC) 4.2.3 (Ubuntu 4.2.3-2ubuntu7) glibc 2.7.1 Free Pascal Compiler version 2.2.0 [2008/04/01] for i386 java version "1.6.0_06" Q:Free Pascal Runtime Error Numbers A:Refer to here http://www.freepascal.org/docs-html/user/node16.html for detailed runtime error informations. We list some frequently used error numbers here: Q:Where is the input and the output? A:Your program shall 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" if you try to do so. Here is a sample solution for problem 1001 using C++:
#include <iostream>
using namespace std;
int main()
{
int a,b;
while(cin >> a >> b)
cout << a+b << endl;
}
Here is a sample solution for problem 1001 using C:
#include <stdio.h>
int main()
{
int a,b;
while(scanf("%d %d",&a, &b) != EOF)
printf("%d\n",a+b);
}
Here is a sample solution for problem 1001 using PASCAL(FPC):
program p1001(Input,Output);
var
a,b:Integer;
begin
while not eof(Input) do
begin
Readln(a,b);
Writeln(a+b);
end;
end.
Here is a sample solution for problem 1001 using Java:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while (in.hasNextInt()) {
int a = in.nextInt();
int b = in.nextInt();
System.out.println(a + b);
}
}
}
Q:Why did I get a Compile Error? It's well done! A:There are some differences between GNU and MS-VC++, such as:
Q:What is the meaning of the judge's reply XXXXX? A:Here is a list of the judge's replies and their meaning:
Queuing : The judge is so busy that it can't judge your submit at the moment, usualy you just need to wait a minute and your submit will be judged.
Floating Point Error : Divide by 0 Runtime Error : See FAQ below Q:How to submit a Java solution? A: See the sample solution above. Basically you should submit a single source file which contains a public class Main and it should have a method with signature "public static void main(String[] args)" which is the entry of your program. Q:Which Java classes can I use? A: You can only use classes in those packages: java.lang, java.io, java.nio, java.math, java.util, java.text and java.net. You are not allowed to catch any Error in your try-catch, read, write or create any file, or create Socket, etc. In one word, don't do anything other than solving the problem. Q:What does Runtime Error mean? A: If you are using Java, please check the class signature as well as the main method signature, and don't use any class which is not allowed. If you are using other languages, your program may have executed a forbidden operation, like invoking privileged syscalls, file operation, etc. Notice that buffer overflow and stack overflow can also lead to this error. |