1354 - I2P(I)2017_EECS_Midterm2 Scoreboard

Time

2017/12/06 08:00:00 2017/12/06 10:00:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
11715 I2P_17_EECS_MID_2_1
11716 I2P_17_EECS_MID_2_2
11724 I2P_17_EECS_MID_2_3

11715 - I2P_17_EECS_MID_2_1   

Description

(7 points)

Given an n-by-n square matrix A, please calculate the 2-by-2 block-wise transpose of A.
By 2-by-2 block-wise transpose, we mean to compute the transpose of every 2-by-2 block in A. 

For example, if the square matrix A is
1 2 3 4
5 6 7 8
8 7 6 5
4 3 2 1

The result of 2-by-2 block-wise transpose of A is
1 5 3 7
2 6 4 8
8 4 6 2
7 3 5 1

The upper-left block 
1 2
5 6
has been transposed into 
1 5
2 6
and the upper-right block
3 4
7 8
has been transposed into
3 7
4 8
so on and so forth.

Input

The first line contains an integer n, representing the length of A's side. It is guaranteed that 1 < n < 500, and n is always a multiple of 2.

The next n lines represent the n rows of A. Each row contains n integers.

Output

Print the the 2-by-2 block-wise transpose of A.
Remember to add a new line at the end of your answer.

Sample Input  Download

Sample Output  Download

Tags




Discuss




11716 - I2P_17_EECS_MID_2_2   

Description

Probelm: Min Max (6 points)

Given a sequence of min and max operations, calculate the answer.

'M35' means max(3, 5) and the answer is 5.
'm62' means min(6, 2) and the answer is 2.

For a longer sequence such as 'M3mM42m56', it means
max( 3, min(max(4, 2), min(5, 6)))
and the answer is 4.

:)

 

Input

A sequence of min and max operations.
Operands are integers in the range between 0 and 9.

'M' denotes max and 'm' denotes min.

There is a symbol '=' at the end of input. 

No blanks between elements.

The length of input (including '=') is less than or equal to 40.

Output

Print the answer.

No newline character at the end of output. 

Sample Input  Download

Sample Output  Download

Tags

so hard



Discuss




11724 - I2P_17_EECS_MID_2_3   

Description

Probelm: Shooting star (2 points)

Writer: arcchang1236       Description: arcchang1236       Difficulty: ★★★★★

"This is a classical problem for NTHU CSI2P students three years ago, many people had difficulty in solving it. However, we think the students this year are much better than us at that time, so all of you can solve it!"

You want to stimulate shooting route in a room. You know the boundery of room, start point of a shooting object, and the direction of shooting. When the object hitting the boundary, it would reflect with 45 degree. Your mission is to show the route of the shooting object.

You are asked to use 2-D array to solve this problem

 

Input

The first line has three numbers, CF and H, which respectively means the length of the ceiling, the length of the floor, and the height between the ceilings and floors.

The second line has a number S, which means the start point of shooting object. It's noted that the location below the ceiling is 1, and the location below that is 2, and so on.

  • 1 ≤ C, F ≤ 20
  • 2 ≤ H ≤ 20
  • 1 ≤ S ≤ H

The third line has a character 'u' or 'd'. It  corresponds to the initial direction of shooting.

  • u: upper-right in 45 degree
  • d: lower-right in 45 degree

There are only one case for each testcase

Output

Draw the map and the route of the shooting object.
The route of shooting object is marked as '*', which appears until the object is out of boundaries.

You need to use a (H+2)*(max{C, F, the horizontal length of route of shooting}) array to print out the result

(for example, 範例一 print 5*10 array)

Remember there is '\n' in the end.

Sample Input  Download

Sample Output  Download

Tags




Discuss