Upload
rofaelemil
View
215
Download
0
Embed Size (px)
Citation preview
8/8/2019 EOI 2006 under 15
http://slidepdf.com/reader/full/eoi-2006-under-15 1/8
EOI 2006 Contest (Under 15)
August 29, 20061
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.
8/8/2019 EOI 2006 under 15
http://slidepdf.com/reader/full/eoi-2006-under-15 2/8
EOI 2006 Contest (Under 15)
August 29, 20062
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 2integers. 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 totalbenefit.
Example
File: market.in File: market.out
45 3
4 2
1 106 2
45
8/8/2019 EOI 2006 under 15
http://slidepdf.com/reader/full/eoi-2006-under-15 3/8
EOI 2006 Contest (Under 15)
August 29, 20063
crossword
Task
You are in the process of creating a crossword puzzle. You've already designed the board, but now youneed 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 = 24. 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 numberof 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.
8/8/2019 EOI 2006 under 15
http://slidepdf.com/reader/full/eoi-2006-under-15 4/8
EOI 2006 Contest (Under 15)
August 29, 20064
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 63
2
8/8/2019 EOI 2006 under 15
http://slidepdf.com/reader/full/eoi-2006-under-15 5/8
EOI 2006 Contest (Under 15)
August 29, 20065
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 to1000 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
7
32
4
1010
7
410
7
3
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.
8/8/2019 EOI 2006 under 15
http://slidepdf.com/reader/full/eoi-2006-under-15 6/8
EOI 2006 Contest (Under 15)
August 29, 20066
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 themaximum 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).
8/8/2019 EOI 2006 under 15
http://slidepdf.com/reader/full/eoi-2006-under-15 7/8
EOI 2006 Contest (Under 15)
August 29, 20067
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 themare 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.
8/8/2019 EOI 2006 under 15
http://slidepdf.com/reader/full/eoi-2006-under-15 8/8
EOI 2006 Contest (Under 15)
August 29, 20068
Example
File: knight.in File: knight.out
4
-1 2
0 0-1 -2
3 1
2
2
Explanation of the Example
-2 -1 0 1 2
C A
B
D
1-Attaacking position: B-C and B-A2-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.