Beruflich Dokumente
Kultur Dokumente
Make sure that you submitted your source files in lowercase letters.
1
August 29, 2006
EOI 2006 Contest (Under 15)
market
Task
You are the owner of a super market. Today you have got from your employees how many
transactions they have performed. Each transaction is described by a number of items as well
as the benefit per item. Your task is to calculate your total benefit during this day.
Input
• 1st line: 1 integer N (1<= N <= 1000) which is the number of transactions.
• Each of the next N lines will describe one transaction. Each transaction is described by 2
integers. The first one K is the number of items and the second one B is the benefit per
item. Note that (1 <= K <= 100) and (1 <= B <= 100).
Output
The output file will be a text file named “market.out” and contains 1 integer which is the total
benefit.
Example
2
August 29, 2006
EOI 2006 Contest (Under 15)
crossword
Task
You are in the process of creating a crossword puzzle. You've already designed the board, but now you
need to come up with words of various sizes to put in the puzzle. An empty crossword puzzle consists of
filled squares ('X') and empty squares ('.'). Here is an example of a board with 5 rows and 6 columns
A "slot" of length N is defined as exactly N empty squares in a row, surrounded on both sides by either a
filled square or the edge of the board. N must be at least 2. There are five horizontal slots in the example
puzzle above:
Given the board representing an empty crossword puzzle, and an int S, your program should calculate
the number of horizontal slots in the puzzle that are exactly S characters in length.
Input
• 1st line: 2 integer N and M (3 <= N,M <= 50) which is the number of rows and the number
of columns of the board.
• 2nd line: 1 integer S (2<=S<=M)
• Each of the next N lines, contains M characters that are either ‘.’ or ‘X’ representing the
board.
3
August 29, 2006
EOI 2006 Contest (Under 15)
Output
The output file will be a text file named “crossword.out” and contains one integer which is the the
number of horizontal slots in the puzzle that are exactly S characters in length.
Example
4
August 29, 2006
EOI 2006 Contest (Under 15)
num
Task
Given a group of N integers, you are to count the maximum frequency of an integer in this
group. A frequency of an integer means how many times this number appeared in the group.
Input
Output
The output file will be a text file named “num.out” and contains 1 integer which is the maximum
frequency.
Example
5
August 29, 2006
EOI 2006 Contest (Under 15)
word
Task
Given a word W, you are to calculate the maximum length of a consecutive sequence of
letters that are the same.
Input
The input file will be a text file named “word.in” containing 1 line representing the word W.
The word consists only of uppercase letters (capital letters). Note also that the word size
ranges from 1 to 255 inclusive.
Output
The output file will be a text file named “word.out” and contains 1 integer which is the
maximum length of a consecutive sequence of letters that are the same.
Example
In the example above, the maximum length of consecutive letters that are the same is 3. (CCC and
also EEE).
6
August 29, 2006
EOI 2006 Contest (Under 15)
knight
Task
Suppose we have a knight on a chessboard of infinite size. The knight can move in one of 8
positions. The following figure describes the allowed moves for a knight.
* *
* *
K
* *
* *
A pair of knights is in 1-Attacking position if one of them can reach the other in 1 move.
A pair of knights is in 2-Attacking position if one of them can reach the other in 2 moves.
Your task is given the positions of N knights on the board; calculate how many pair of them
are in 1-Attacking position and how many pair are in 2-Attacking position.
Input
Output
7
August 29, 2006
EOI 2006 Contest (Under 15)
Example
-2 -1 0 1 2
C A
B
For each test case if the 2 numbers in your output are correct, you get 100% of the scores of this
case. If only one of them is correct you will get 50% of the scores of this case.
8
August 29, 2006