536 - 競程 CPE 班第一次模擬考 Scoreboard

Time

2013/11/08 18:05:00 2013/11/08 23:05:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
9108 String Reverse
9124 Power
9152 Stable Sort
9312 Postfix Evaluation
9316 Can You Escape?

9108 - String Reverse   

Description

A string S is given, please output the reverse of S.

Input

Input contains multiple test cases. Each case contains one line with a string S. The string S only consists of A-Z, a-z, 0-9. The length of S is less than or equal to 107. The input is terminated by EOF.

Output

For each test case, output a line with the reverse of S.

Sample Input  Download

Sample Output  Download

Tags




Discuss




9124 - Power   

Description

Compute ab for the given integers a and b.

Input

The first line of input contains a positive integer t (t <= 100), which indicates the number of test cases.  For each case, there are two positive integers a, b in a line (a ,b < 250).

Output

For each test case, output in a single line.

Sample Input  Download

Sample Output  Download

Tags




Discuss




9152 - Stable Sort   

Description

Given the grades of N people.
Output the sorted result in ascending order.


Hint: Ascending order is an order of sorting that starts with the lowest value and proceeds to the highest value

Input

The first line of input contains a positive integer t , which indicates the number of test cases.

In each test case, the first line contains one integer N.

The following N lines specify the name Si and the grade Gi.

t <= 60
1 <= |Si| <= 7
0 <= Gi <= 100 (Gi is an integer.)
test case 1: 1 <= N <= 103
test case 2: 1 <= N <= 104
test case 3: 1 <= N <= 105
test case 4: 1 <= N <= 5*106

Output

Output the result in N lines. Every line contains the name and the grade. If more people’s grades are same, output by input order. (That means it uses stable sort.)

Sample Input  Download

Sample Output  Download

Tags




Discuss




9312 - Postfix Evaluation   

Description

Evaluate the result of a given numerical expression written in postfix notation.

Input

There are many test cases. Each line represents a test case.

Each line has a numerical expression written in postfix notation, and the number of “characters” in a line will not greater than 10^5.

Every number in input will fit in 32-bit signed integers.
The operators contain only “+”,”-“,”*”and”/”, and the division “/” here is considered as integral division.

Output

The output of each test case occupies a line. Each line begins with the test case number”Case i:”, and then a space character followed by the evaluated answer.
The answer will fit in 64-bit number.
However, if the expression is invalid, please print “Case i: error!”.
It’s guaranteed that in the first and second test case, there are all valid expressions.

9312 : all expressions are valid.
9313 : all expressions are valid.
9314 : some expressions are invalid.
9315 : some expressions are invalid.

Sample Input  Download

Sample Output  Download

Tags




Discuss




9316 - Can You Escape?   

Description

Given a map, how fast can you find the exit and then escape?
The map is a 2-dimensional grid of squares, each square is either free or filled with a wall. The exit is hidden among one of the free spaces.
You can move between adjacent free squares vertically or horizontally, diagonal movement is not allowed. You may not go across walls and leave the range of given map.
You have to arrive the position of button first (so that the exit appears) and then you can go to the exit.

Input

The input consists of several maps. Each map begins with a line containing two integer numbers R and C (1 <= R, C <= 4000) specifying the map size. Then there are R lines each containing C characters.

Each character is one of the following:
s : Your start position.
. : A free square that you can move.
b : The position of the button.
w : The wall.
e : The hidden exit.

The position of start point, button and exit are guaranteed to be difference.
There are exactly one button and exactly one exit.
There is one blank line after each map. The input is terminated by end of file.

9316: O( 4(R*C) ) can pass this case
9317: O( (R*C)2 ) can pass this case
9318: O( (R*C) lg (R*C) ) can pass this case
9319: O( R*C ) can pass this case

Output

For each map, print one line containing the sentence "Escape in S steps.", where S is the smallest possible number of step to escape. If no way to escape, output the string "No solution." instead.
One step is defined as a movement between two adjacent squares. Pressing button does not count as a step.

Sample Input  Download

Sample Output  Download

Tags




Discuss