644 - CS135501_I2P2014_Lab_6 Scoreboard

Time

2014/11/10 16:00:00 2014/11/10 17:30:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
10191 Jingle Composing
10192 Train
10201 Cross Bomb!!

10191 - Jingle Composing   

Description

In music, a note has a duration (for how long the note should sound). A jingle is divided into a sequence of measures, and a measure is formed by a series of notes.
The duration of a note is indicated by its shape. In this problem, we will use uppercase letters to indicate a note's duration. The duration of a measure is the sum of the durations of its notes. The duration of a measure must always be 1.
The following table lists all the available notes:
 
 
For example, there is a composition containing five measures, of which the first four have the correct duration and the last one is wrong. In the example below, each measure is surrounded with slashes and each note is represented as in the table above.
/HH/QQQQ/XXXTXTEQH/W/HW/
You are asked to write a program that determines how many measures have the right duration.
 

Input

A single line containing a string whose length is at least 3 characters, inclusive, representing a composition. A composition begins and ends with a slash `/'. Measures in a composition are separated by a slash `/'. Each note in a measure is represented by the corresponding uppercase letter, as described above. You may assume that each composition contains at least one measure and that each measure contains at least one note. All characters in the input will be either slashes or one of the seven uppercase letters used to represent notes, as described above.

Output

Your program must output a single line, containing a single integer, the number of measures that have the right duration. The right duration is one.

Note: there is a newline in output.

Sample Input  Download

Sample Output  Download

Tags




Discuss




10192 - Train   

Description

tTrainThere is a train with 10 carriages. The carriages have different numbers of passengers. For example, the numbers of passengers they have could be 5 8 23 10 30 20 15 10 2 2.

Passengers can get on, get off, move forward and move backward the carriages. The operations are presented in a format as follows:

I 0 0 0 5 4 3 4 0 0 1
O 0 1 1 0 0 2 3 0 0 0
F 0 0 0 0 2 0 0 0 0 0
B 0 1 0 0 0 0 0 0 0 0
O 2 0 0 0 0 0 0 0 0 0
I 0 0 0 0 5 0 0 0 0 0

where 'I' stands for getting on, 'O' stands for getting off, 'F' stands for moving forward, and 'B' stands for moving backward. The numbers represent the numbers of passengers doing the action on the corresponding carriages.

For example, the getting on operation "I 0 0 0 0 5 0 0 0 0 0" means that five passengers get on the 5th carriage, and likewise, the getting off operation "O 2 0 0 0 0 0 0 0 0 0" means that two passengers get off the 1st carriage. The moving forward operation "F 0 0 0 0 2 0 0 0 0 0" means that two passengers move from the 5th carriage to the 4th carriage, and likewise, the moving backward operation "B 0 1 0 0 0 0 0 0 0 0" means that a passenger moves from the 2nd carriage to the 3rd carriage.

Example:

Operation

Number of passenger in each carriage

 

5 8 23 10 30 20 15 10 2 2

I 0 0 0 5 4 3 4 0 0 1

5 8 23 15 34 23 19 10 2 3

O 0 1 1 0 0 2 3 0 0 0

5 7 22 15 34 21 16 10 2 3

F 0 0 0 0 2 0 0 0 0 0

5 7 22 17 32 21 16 10 2 3

B 0 1 0 0 0 0 0 0 0 0

5 6 23 17 32 21 16 10 2 3

O 2 0 0 0 0 0 0 0 0 0

3 6 23 17 32 21 16 10 2 3

I 0 0 0 0 5 0 0 0 0 0

3 6 23 17 37 21 16 10 2 3

 

Note that none of the passengers will move forward from the 1st carriage, and likewise, none of the passengers will move backward from the 10th carriage. And the number of passengers that is going to get off the carriage will not exceed the number of passengers in that carriage.

Input

The first line contains ten positive integers indicating the initial numbers of passengers on the ten carriages.

The second line contains an integer N (1<=N<=100) denoting the number of operations.

The next N lines contain the N operations.

Output

Output the numbers of passengers from the 1st carriage to the 10th carriage. The numbers are separated by a space.

[Note]There is a space at the end of the output but no newline at the end.

Sample Input  Download

Sample Output  Download

Tags




Discuss




10201 - Cross Bomb!!   

Description

Consider an N-by-N two-dimensional map which is filled with symbol '+'.
Now, we detonate(引爆) several bombs on the map.
The shape of explosion is cross that is centered at the location (ROW,COLUMN) and with a radius of 2.
Fill the part of cross with symbol S.

For example, the following is a 10-by-10 map, where the bomb is centered at (4, 4).
That is, we have N=10, ROW=4, COLUMN=4 and S='-'.


Note that, in some cases, the bomb might be close to the border of the map,
and therefore only a part of the cross can be shown on the map.

For example,

And if there have several bombs,
the bomb will cover the current symbol that may be the initial symbol or the previous bombs' on the map.

Input

The first line is an integer N (1<=N<=30) denoting the size of the map.

The second line is an integer M ( 1<=M<=10 ) denoting the amount of bombs.

Start from third line, you need to read M lines.
And each line contains three elements, in the order of ROW, COLUMN and S: 

  • Two integers ROW and COLUMN (1<=ROW,COLUMN<=N) denoting the location of the bomb.
  • A character S denoting the symbol that is drawn on the map.

Output

The N-by-N map, displayed in N lines. Each line is ended with a newline character '\n'.

Sample Input  Download

Sample Output  Download

Tags




Discuss