The Problems
Programming contests consist of about eight problems, each requesting you to program an algorithm that solves the problem. To give you an idea of what kind of problems are used at the contest, and how these problems are presented to you, we have provided the problem set used in the preliminary rounds for the BAPC 2005, as well as a sample problem - with a sample solution - from a contest held back in 1994.
BAPC 2005 test session and BAPC 2005 contest problem set
The problems used in the contest round are available as a PDF file. The input, output, and sample solutions for both sessions are available as a gzipped tarball.
Test session | ||||
---|---|---|---|---|
Problem | Sample input | Judge's input | Judge's output | Sample solution in C |
A | a.in | a.in | a.out | a.c |
B | b.in | b.in | b.out | b.c |
C | c.in | c.in | c.out | c.c |
Contest | |||||||
---|---|---|---|---|---|---|---|
Sample solution | |||||||
Problem | Sample input | Judge's input | Judge's output | C | C++ | Java | Pascal |
A | a.in | a.in | a.out | - | a.cpp | ProblemA.java | a.pas |
B | b.in | b.in | b.out | b.c | b.cpp | ProblemB1.java ProblemB2.java |
- |
C | c.in | c.in | c.out | c.c | c.cpp | - | - |
D | d.in | d.in | d.out | - | d.cpp | - | d.pas |
E | e.in | e.in | e.out | e.c | e1.cpp e2.cpp |
ProblemE1.java ProblemE2.java |
- |
F | f.in | f.in | f.out | - | f1.cpp f2.cpp |
ProblemF.java | - |
G | g.in | g.in | g.out | - | g.cpp | ProblemG.java | - |
H | h.in | h.in | h.out | - | h.cpp | ProblemH.java | - |
BAPC 2005 preliminary rounds' problem set
The problems used in these rounds are available as a PDF file. The sample input, input/output used by the judges, and sample solutions are also available as gzipped tarballs.
Sample solution | ||||||
---|---|---|---|---|---|---|
Problem | Sample input | Judge's input | Judge's output | C++ | Java | Pascal |
A | a.in | a.in | a.out | a.cpp | - | a.pas |
B | b.in | b.in | b.out | b.cpp | b.java | - |
C | c.in | c.in | c.out | c.cpp | c.java | - |
D | d.in | d.in | d.out | d.cpp | - | d.pas |
E | e.in | e.in | e.out | e.cpp | - | e.pas |
F | f.in | f.in | f.out | f.cpp | f.java | - |
G | g.in | g.in | g.out | g.cpp | - | g.pas |
H | h.in | h.in | h.out | h.cpp | - | h.pas |
Simply Syntax
In the land of Hedonia the official language is Hedonian. A Hedonian professor
had noticed that many of her students still did not master the syntax of
Hedonian well. Tired of correcting the many syntactical mistakes, she decided to
challenge the students and asked them to write a program that could check the
syntactical correctness of any sentence they wrote. Similar to the nature of
Hedonians, the syntax of Hedonian is also pleasantly simple. Here are the
rules:
0. The only characters in the language are the characters p through z and N, C,
D, E, and I.
1. Every character from p through z is a correct sentence.
2. If s is a correct sentence, then so is Ns.
3. If s and t are correct sentences, then so are Cst, Dst, Est, and Ist.
4. Rules 0. to 3. are the only rules to determine the syntactical correctness
of a sentence.
You are asked to write a program that checks if sentences satisfy the syntax
rules given in Rule 0. - Rule 4.
Input:
The input consists of a number of sentences consisting only of characters p
through z and N, C, D, E, and I. Each sentence is ended by a new-line character.
The collection of sentences is terminated by the end-of-file character. If
necessary, you may assume that each sentence has at most 256 characters and at
least 1 character.
Output:
The output consists of the answers YES for each well-formed sentence and NO for
each not-well-formed sentence. The answers are given in the same order as the
sentences. Each answer is followed by a new-line character, and the list of
answers is followed by an end-of-file character.
Sample Input:
Cp
Isz
NIsz
Cqpq
Sample Output:
NO
YES
YES
NO
had noticed that many of her students still did not master the syntax of
Hedonian well. Tired of correcting the many syntactical mistakes, she decided to
challenge the students and asked them to write a program that could check the
syntactical correctness of any sentence they wrote. Similar to the nature of
Hedonians, the syntax of Hedonian is also pleasantly simple. Here are the
rules:
0. The only characters in the language are the characters p through z and N, C,
D, E, and I.
1. Every character from p through z is a correct sentence.
2. If s is a correct sentence, then so is Ns.
3. If s and t are correct sentences, then so are Cst, Dst, Est, and Ist.
4. Rules 0. to 3. are the only rules to determine the syntactical correctness
of a sentence.
You are asked to write a program that checks if sentences satisfy the syntax
rules given in Rule 0. - Rule 4.
Input:
The input consists of a number of sentences consisting only of characters p
through z and N, C, D, E, and I. Each sentence is ended by a new-line character.
The collection of sentences is terminated by the end-of-file character. If
necessary, you may assume that each sentence has at most 256 characters and at
least 1 character.
Output:
The output consists of the answers YES for each well-formed sentence and NO for
each not-well-formed sentence. The answers are given in the same order as the
sentences. Each answer is followed by a new-line character, and the list of
answers is followed by an end-of-file character.
Sample Input:
Cp
Isz
NIsz
Cqpq
Sample Output:
NO
YES
YES
NO
The input used to check contestant's solutions can be found here, the output that the solution should generate is behind this link, and here's a sample solution in C.