Central European Olympiad
in Informatics 2004
University of Information Technology and Management, July 2004, Rzeszˇw, Poland
 CEOI 2004 
 Results !!! 
Internet contest

General information

On-line competition started
The trial session of the on-line competition has been started. Visit the contest web page http://sio.mimuw.edu.pl/ceoi2004/ in order to participate on-line.
First, you have to register (find the link Registration). Follow the link Tasks to see the tasks. After you login, use the link Submit Solutions to submit your solution.

Internet contest will be organized together with CEOI 2004 on-site competition. The online contest starts three hours after the local competition and consists of 2 rounds (24 hours each). It starts on 14th July 2004, 12.00am (CEST) and ends on 16th July 2004, 12.00am (CEST).


The only allowed programming language is Java (programs will be tested with Sun JDK v. 1.4.2_04).
Each solution must conform to the following specification (suppose that we write a solution for task ABC):
  • The solution consists of exactly one source file.
  • The source file contains public class ABC (names are case sensitive). There must be defined method public static void main(String[] args) - it is the starting point for the program.
  • The solution cannot contain keyword package.
  • It is possible to define many classes within one source code, but only class ABC can be declared as a public.
Compilation and execution
  • Source code is compiled with a command: javac <name>.java.
  • Program is executed with a command: java -client -XmxYYY Program
    YYY denotes the memory limit depending on the problem being solved.

Sample programs

Square (squ)


Write a program, that reads an integer x from the standard input (-100 <= x <= 100) and writes on the standard output the value x*x.

Solution in Java (file SQU.java)

import java.io.*;
import java.util.*;

public class SQU {
public static void main(String[] args) {
        try {
            BufferedReader rd=new BufferedReader(new InputStreamReader(System.in));
            StringTokenizer t=new StringTokenizer(rd.readLine());
            int x=Integer.parseInt(t.nextToken());
        } catch (IOException e) { }

Inverse (inv)


Write a program, that for a given string of a length between 1 and 100 writes a string with inversed letters.

Solution in Java(INV.java)

import java.io.*;

public class INV {
public static void main(String[] args) {
        try {
            BufferedReader rd=new BufferedReader(new InputStreamReader(System.in));
String line=rd.readLine();
for(int i=line.length()-1; i>=0; i--) System.out.print(line.charAt(i));
        } catch (IOException e) { }