Frequently Asked Questions

賀心嶄猟井諒籾嚥盾基
Q What does "HDOJ" stand for ?
A HDOJ is short for Hangzhou Dianzi University Online Judge which was founded in September 2005 and has the lastest version of 2.0.
Q Which programming languages can I use at Online Judge ?
A C, C++, Pascal and Java are currently supported at Online Judge.
Q How to write a solution using my favourite programming language ?
A You can find the answer in corresponding section:
Q Is there any way to determine if my program is runned at Online Judge or not ?
A There is a conditional define of compiler called ONLINE_JUDGE. Example of using:

C/C++
#ifdef ONLINE_JUDGE
    running on online judge
#endif
Pascal
{$IFDEF ONLINE_JUDGE}
    running on online judge
{$ENDIF}
Q What kind of input and output can I use at Online Judge ?
A Only stdin (standard input) and stdout (standard output) can be used. For instance, you can use scanf in C or cin in C++ to read, and printf in C or cout in C++ to write. Your 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.
Besides, you should note that, in most cases, C runtime I/O functions are more effective than those of C++'s, so scanf and printf is recommended to process huge input or output.
Q What are the meanings of the judge's replies
A Here is a list of the Judge's replies and their meaning:

Q What does "Special Judge" mean ?
A When a problem has multiple acceptable answers, a special judge program is needed. The special judge program uses the input data and some other information to check your program's output and returns the result to the judge.
Q My program got an AC in C++ while TLE in G++ !
A This mostly occurs in the case that your program have to process huge input. As we known, MS-VC++ is more effective to process I/O althrough we have tried our best to reduce the difference. This can hardly occur because we have tested most of the test cases in both C++ and G++ before we publish a problem on condition that you solve the problem with correct algorithms.
Q I'm sure that my program is incorrect but I still got an AC !
A Maybe our test cases are not strong enough to catch the bugs in your program. Please let us know.
Q How can I participate in online contests ?
A There are two kinds of online contests at HDOJ. One is public and the other is private. Everyone who has an account of HDOJ can participate in a public contest, but only specified ones who had been invited to the contests can take part in a private one.
To participate in the public contests, you should register an account first if you don't own one, then use your account and password to log in the contest.
To participate private ones, your should use the id and password supplied by the organizer for login.
Q Can I arrange a contest at HDOJ ?
A If you want to arrange a programming contest, and you don't have enough equipments or time to setup an automated judge, HDOJ will be pleased to host the contest for you.
What you need to setup your own contest are: Send the stuff above to lcy@hdu.edu.cn by email and wait for our reply. If your apply is accepted, your contest will be arranged in HDOJ's contests schedule.
Q How to use 64-bit integer types ?
A Server supports signed and unsigned 64-bit integers.
Q How can I read input data until the end of file ?
A You can do it for example like this:
Language C C++ Pascal
To read numbers int n;
while(scanf("%d", &n) != EOF)
{
  ...
}
int n;
while (cin >> n)
{
  ...
}
var n: integer;
...
while not seekeof do
begin
  read(n);
  ...
end;
To read characters int c;
while ((c = getchar()) != EOF)
{
  ...
}
char c;
while (cin.get(c))
{
  ...
}
var c: char;
...
while not eof do
begin
  read(c);
  ...
end;
To read lines char line[1024];
while(gets(line))
{
  ...
}
string line;
while (getline(cin, line))
{
  ...
}
var line: string;
...
while not eof do
begin
  readln(line);
  ...
end;
Q What is the maximal size of program that can be submitted ?
A The maximal size of program is 65535 characters.

This page was generated by web cache at 2015-09-06 02:15:18