Sie sind auf Seite 1von 8

EOI 2006 Contest (Under 15)

Task Overview Sheet

market crossword num word knight

Source file market.cpp crossword.cpp num.cpp word.cpp knight.cpp

Input file market.in crossword.in num.in word.in knight.in

Output file market.out crossword.out num.out word.out knight.out

Time limit/test 1 sec 1 sec 1 sec 1 sec 1 sec

Memory Limit 128 MB 128 MB 128 MB 128 MB 128 MB

Total points 100 100 100 100 100

Make sure that your envelope contains the following:

• The EOI 2006 Competition tasks in 8 pages including this page.


• A user name and password.

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

The input file will be a text file named “market.in”:

• 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

File: market.in File: market.out


4 45
5 3
4 2
1 10
6 2

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:

1. First row, length = 4


2. Third row, length = 3
3. Third row, length = 2
4. Fifth row, length = 2
5. Fifth row, length = 3

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

The input file will be a text file named “crossword.in”:

• 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

File: crossword.in File: crossword.out


5 6 2
3

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

The input file will be a text file named “num.in”.

• 1st line: 1 integer N (2<= N <= 1000)


• The next N lines represent the group of integers. All integers will be in the range from 0 to
1000 inclusive.

Output

The output file will be a text file named “num.out” and contains 1 integer which is the maximum
frequency.

Example

File: num.in File: num.out


10 3
7
3
2
4
10
10
7
4
10
7

The frequency of 7 is 3. The frequency of 10 is 3. The frequency of 4 is 2. The frequency of 2 is 1. The


frequency of 3 is 1. The maximum frequency is 3.

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

File: word.in File: word.out


ABBCCCDFGKLEEECC 3

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

The input file will be a text file named “knight.in”:


ƒ 1st line: 1 integer N representing how many knights we have on the board.
(2<=N<=30).
ƒ The next N lines describe the positions of each of the N knights. Each knight is
described by 2 integers: the row number then the column number.

Output

The output file will be a text file named “knight.out”:


ƒ 1st line: An integer representing how many pair of knights are in 1-Attacking position.
ƒ 2nd line: An integer representing how many pair of knights are in 2-Attacking
position.

7
August 29, 2006
EOI 2006 Contest (Under 15)

Example

File: knight.in File: knight.out


4 2
-1 2 2
0 0
-1 -2
3 1

Explanation of the Example

-2 -1 0 1 2
C A
B

1-Attaacking position: B-C and B-A


2-Attaacking position: A-C and B-D

Notes for Grading

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

Das könnte Ihnen auch gefallen