没有合适的资源?快使用搜索试试~ 我知道了~
非洲及中东地区ACM试题(2000-2007)
需积分: 9 56 下载量 114 浏览量
2008-02-02
23:08:38
上传
评论
收藏 2.73MB PDF 举报
温馨提示
试读
221页
世界各地(包括世界总决赛及各个地区竞赛如北美, 亚洲, 欧洲, 拉美, 大洋州, 非洲和中东等)最新(2000-2007)的ACM竞赛英文真题.这是非洲及中东地区部分.文件格式为pdf.
资源推荐
资源详情
资源评论
2168 - Convert
Africa and the Middle East - Africa and Arab - 2000/2001
The importance of postfix and prefix notation in parsing arithmetic expressions is that these notations are
completely free of parentheses. Consequently, an expression in postfix (or prefix) form is crucial because
having a unique form for an expression greatly simplifies its evaluation. But we humans prefer to read and
evaluate an infix expression especially when it is parenthesized.
We would like to try the conversion from the postfix format to the parenthesized infix format for expression
written in some functional language. The language will consist of the unary function INV and the binary
functions ADD and MUL.
Input
The input shall consist of several cases. Each case will be represented on a separate line. The number of cases
will be given in the first line of the input.
Output
For each input case, the converted expression should be on a separate line, and should have a space after each
comma.
Sample Input
2
2 -3 Add Inv 6 10 Mul Mul
100 1000 MUL 10 ADD INV
Sample Output
Mul ( Inv (Add (2, -3)), Mul (6, 10))
Inv ( Add (10, Mul (100, 1000)))
Africa and Arab 2000-2001
2168 - Convert 1/1
2169 - Text Justification/Wrapping
Africa and the Middle East - Africa and Arab - 2000/2001
This problem is about right justification of the text. By that we mean that the printed form of the text is such
that the right margin is aligned for all lines in the output. This task is normally achieved by first attempting to
split words across lines, and then by leaving a certain amount of spaces between words.
Assumptions
For this problem, assume that words are not to be split between lines and that each line is to be both left and
right justified, except for the last line of text. Any extra blank characters which are required in the justification
of the text are to be distributed as uniformly as possible between the words of a line. Furthermore, we assume
that there are no paragraphs and that pagination and indentation are not required. Finally, each word in the
input text is separated from every other word by a blank, and each punctuation symbol is followed by a blank.
For the output, assume 50 characters per line.
Sample Input
Sultan Qaboos university is a young university compared
to universities found in the ArabianGulf region.
However, it has an excellent reputation in the region.
The university enjoys solid infrastructure, stable
academic platforms, and state of the art facilities.
The university includes six colleges, four centers, three
libraries, and a hospital. A new college of information
technology seems to be on the horizon, and may be
announced any time.
Sample Output
Sultan Qaboos university is a young university
compared to universities found in the ArabianGulf
region. However, it has an excellent reputation in
the region. The university enjoys solid
infrastructure, stable academic platforms, and
state of the art facilities. The university
includes six colleges, four centers, three
libraries, and a hospital. A new college of
information technology seems to be on the horizon,
and may be announced any time.
Africa and Arab 2000-2001
2169 - Text Justification/Wrapping 1/1
2170 - Logic World
Africa and the Middle East - Africa and Arab - 2000/2001
"Logic World" is a company that produces systems with extensive use of bitwise operators. Before hiring
engineers, the company tests their ability to write programs that manipulate bit-strings to evaluate both their
programming skills and their mastery of the bitwise operators: OR, AND, NOR, NAND and XNOR. The test
gives three bit-strings of length 40 represented in hexadecimal, and five operations to be performed on these
bit-strings. Given the strings S1, S2 and S3, the operations to be performed will be: S1 AND S2, S2 OR S3, S1
AND (S2 OR S3), S1 NAND S2 NOR S3, (S1 NOR S2) XNOR (S2 NOR S3)
Challenge yourself by taking this test and see whether you would be hired by ``Logic World"
Input
The input data consists of a set of cases terminated by a case of only X's. Each case is made of 3 bit-strings
separated by a comma and a space.
Output
For each case, results of the five operations should be given as shown in the sample output. Leave a blank line
after each case.
Sample Input
FFFFFF4444, 222F0FFF11, AABBCCDDEE
XXXXXXXXXX, XXXXXXXXXX, XXXXXXXXXX
Sample Output
Case 1:
Operation 1: 222B0CDD00
Operation 2: FFFFFFFF55
Operation 3: AABFCF4444
Operation 4: 0004030000
Operation 5: AABFCFFF55
Africa and Arab 2000-2001
2170 - Logic World 1/1
2171 - Maze
Africa and the Middle East - Africa and Arab - 2000/2001
As a child, did you ever dream of playing in a maze? If you had thought about it, you may have come up with
the idea of marking your paths as you went along. If you were trapped, you could then go back to the last
crossing and take another path. By doing this, your actually applying what is called backtracking. This
problem is about trying to get out of a maze.
Given a maze and a starting point within, you are to determine whether there is a way out. There is only one
exit from the maze. You may move horizontally or vertically (but not diagonally) in any direction in which
there is an open path, but you may not move in a direction that is blocked. If you move into a position where
you are blocked on three sides, you must go back the way you came (backtrack) and try another path.
Input
The should come from a text file. The file contains the original maze, represented as a square matrix of
symbols, with one row of the matrix per line. Each symbol is a character that indicates whether the
corresponding maze is an open path (`O'), a trap (`+'), or the exit (`E'). The size of the maze is 10x10
positions. At the end of the maze in the input file, there a series of starting position coordinates. Each line
contains a pair of values, representing the row and the column of the starting position in the maze. Your task
is to process each of these positions in your quest for the exit from the maze.
Processing
For each starting position, start your move into the maze from the given starting position (in terms of a row
and a column numbers) until you either get to `E' (exit) or get trapped (cannot move). You can move only
where `O' is found.
Output
For each of the ten starting positions, print out the result of your move in the maze, by displaying either Exit
or Trapped in front of the starting position.
Sample Input
O O + E + O O + + + 1 2
O + + O + O + O O O 10 1
O O O O O O + O + O 10 8
+ + + + + O + + O O 7 6
O O O + O O O + O + 1 7
O + O + O + + + O + 8 7
O + O + O O O + O O 7 9
+ + O + + + O + + O 9 3
O + O O O O O + + O 7 1
O + O + + O + O O O 2 8
2171 - Maze 1/2
Sample Output
Starting Position Result
1,2 Exit
10,1 Trapped
10,8 Trapped
7,6 Exit
1,7 Exit
8,7 Exit
7,9 Trapped
9,3 Exit
7,1 Exit
2,8 Trapped
Africa and Arab 2000-2001
2171 - Maze 2/2
剩余220页未读,继续阅读
资源评论
yuanlinios
- 粉丝: 0
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功