1342 - I2P(I)2017_Chen_Midterm2_Practice Scoreboard

Time

2017/11/23 21:00:00 2017/12/07 13:20:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
11689 pA - Matching Point
11690 pB - Transpose
11691 pC - Ponds
11692 pD - Fire
11693 pE - Shooting Star
11694 pF - Prefix Notation

11689 - pA - Matching Point   

Description

Writer : jjjjj19980806       Description : pclightyear       Difficulty : ★★★☆☆

"Speak low when you speak love."

― William Shakespeare, Much Ado About Nothing

YJ is recently crushing on our beloved aspiring professor HT (She doesn't want to admit it, though). One day, HT was teaching about some properties of subsequence. During the class, HT randomly wrote down some strings on the whiteboard. Every time HT wrote down a string s, YJ would randomly wrote down a string t immediately (she loves HT, after all). YJ then wanted to calculate the "matching point" of s and t (HT and YJ). Matching point, according to YJ, is defined as the number of subsequences in s that is exactly the same as t.


For example, if s = abcabc and t = abc, the matching point of s and t is four, and the position of each subsequence is shown as below.

abcabc

abcabc

abcabc

abcabc


If you can help YJ solve her problem, maybe she will send you some photos of HT that she took during the class.

Input

There are multiple lines in each testcase.

Each line contains two strings si, ti, representing the string HT wrote and the string YJC wrote.

It is guaranteed that :

  • At most 10 lines in each testcase.
  • 1 ≤ | si |, | ti | ≤ 20

The input will end with EOF

Output

For each si and ti, please output a line contains one integer representing the matching point of si and ti (HT and YJ). 

Sample Input  Download

Sample Output  Download

Tags




Discuss




11690 - pB - Transpose   

Description

Writer: jjjjj19980806       Description: pclightyear       Difficulty: ★☆☆☆☆

jjjjj doesn't like long description.

Given an m  n matrix A, please calculate the transpose of A.

Note: The is a partial judge problem. We have already handled the input and output for you. All you have to do is to implement the function "Transpose".

Input

The first line contains two integers m, n, representing the dimension of A.

The next m lines contain n integers aij, representing the indices of A.

It is guaranteed that :

  • 1 ≤ m, n ≤ 500

We have already handled the input for you.

Output

Please output the transpose of A.

We have already handled the output for you.

Sample Input  Download

Sample Output  Download

Partial Judge Code

11690.c

Partial Judge Header

11690.h

Tags




Discuss




11691 - pC - Ponds   

Description

Writer: jjjjj19980806       Description: pclightyear       Difficulty: ★★☆☆☆

Frank Lin likes to go mountain climbing. Every time before he goes mountain climbing, he needs to look up the map to plan for the route. According to Frank’s experience, it is very important to locate the position of ponds, since it is usually the best place for resting. Now, Frank gives you a map sized m ✕ n consists of only two symbols '~' and '.', representing water and land, respectively. Frank wonders how many ponds (consecutive position of water) are there on the map.

If you can help Frank solve this problem, maybe he will teach you how to build a tent within five minutes.

Input

The first line contains two integers mn, representing the size of the map Frank gives to you.

The next m lines contain n characters, either '~' or '.', representing the status of position aij.

It is guaranteed that :

  • 1 ≤ m, n ≤ 1000

Output

Please output the number of ponds on the map.

Sample Input  Download

Sample Output  Download

Tags




Discuss




11692 - pD - Fire   

Description

Writer: jjjjj19980806       Description: pclightyear       Photo Credit: eccioa       Difficulty: ★★☆☆☆

                                       Fi - Fi - Fi - Fire!!!!!!!!!!!!

eccioa loves playing minecraft, but he is on fire now!

He looks at the mini map, and he wants to found out if there is any water nearby to put out the fire on him. Unfortunately, there is also some lava nearby, and he can't pass through it (he forgot to bring the potion of fire resistance). If he can't reach any of the water on the map, he will be burned to death miserably.

eccioa now gives you the mini map sized m ✕ consists of four symbols:

'e' stands for the current position of eccioa.

'.' stands for the regular road he can pass through.

'^' stands for lava he cannot pass through.

'~' stands for water. (There may be multiple of them)

Can you tell him whether he can stay alive or not? 

Input

The first line contains two integer mn, representing the size of the map eccioa gives to you.

The next m lines contain n characters, either 'e', '.', '^''~', representing the status of position aij.

It is guaranteed that :

  • 1 ≤ m, n ≤ 1000

Output

If eccioa can stay alive, please print "Alive!", otherwise please print "Dead!".

Sample Input  Download

Sample Output  Download

Tags




Discuss




11693 - pE - Shooting Star   

Description

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, C, F 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




11694 - pF - Prefix Notation   

Description

Difficulty: ★★☆☆☆

Simulate the process of arithmetics(四則運算) in form of prefix notation and calculate the answer.

The characteristic of prefix notation is that operators always precede their operands rather than between then. For example, we see an equation '1 + 2' in conventional infix notation . In prefix notation the expression becomes '+ 1 2'. Another example is (3 - 6) * 2. In prefix notation it becomes ' * - 3 6 2'.

Input

An equation in prefix notation.

Operands are integers in the range between 0 and 9.

There are four operators in this problem: addition('+'), subtraction('-'), multiplication('*'), and division('/').

At the end of an equation there is a '=' symbol. 

No blank space between elements.

No calculate errors(for example, 5/0) will happen.

The length of equations (includes '=') is less than 40.

Output

Show the answer of equation

Note that the answer may be a decimal number, so you are asked to use '%.3f' to show the answer, or you'll get WA even if your answer is correct.

No new line character at the end. 

Sample Input  Download

Sample Output  Download

Tags




Discuss