2617 - I2P(I)2022_Yang_lab6 Scoreboard

Time

2022/10/25 18:30:00 2022/10/25 20:30:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
12434 Bacteria Widespread
13636 Two Zero Two Four

12434 - Bacteria Widespread   

Description

Hey, can I say somthing amazing?  Bacteria touched the air for some reason and begin to widespread in the classroom. The bacteria turned out to be Firmicutes (some kind of bacteria). The classroom can be viewed as a 2D grid map with size R x C. Walls in classroom are denoted as #, clean areas not polluted by Firmicutes are denoted as C, and places where there exist Firmicutes are denoted as F. The classroom is guaranteed to be surrounded by walls. For example a classroom of size 7 x 8 with some area polluted may look like this :

 ########
 #CCC#CC#
 #CFC####
 #CCCCCC#
 #CC#####
 #FCCCCC#
 ########

Firmicutes reproduces rapidly. Initially, some areas in the classroom are polluted by Firmicutes. For every second, if an area is polluted by Firmicutes, the Firmicutes on this area will reproduce themselves and spread to neighboring clean areas. Here, we define neighboring areas of area (r, c) are (r+1, c), (r-1, c), (r, c+1), and (r, c-1). Note that Firmicutes cannot spread onto walls, which means that even if a wall is neighbor to some polluted area, the wall will not be polluted. The following example is a classroom from t = 0 ~ 2 seconds.

Initially, t=0. Some areas are polluted.

 ########
 #CCC#CC#
 #CFC####
 #CCCCCC#
 #CC#####
 #FCCCCC#
 ########

When t=1,

 ########
 #CFC#CC#
 #FFF####
 #CFCCCC#
 #FC#####
 #FFCCCC#
 ########

When t=2,

 ########
 #FFF#CC#
 #FFF####
 #FFFCCC#
 #FF#####
 #FFFCCC#
 ########

Given how the class looks like initially (when t=0) and a time T, please output how the classroom looks like when t=T.

Maybe useful hint

(Feel free to skip this part if you have your own idea on how to solve this problem :) )

1. Use an array or arrays to record how the classroom looks like in the 0-th second, 1-st second, ..., T-th second, respectively.

2. A straightforward implementation:
 
for each second
{
    Step 1: find & record  F 's locations in the classroom.
    Step 2: update the neighbors of each found  F  in Step 1 as required.
}

Input

The first line consist of three integers R, C, T, meaning the size of the classroom and a time.

For the following R lines, each line has C characters, being how the classroom looks like initially. Each character will be one of {#, C, F} and the classroom is surrounded by walls (#).

Technical Restrictions

  • 3 ≦ R, C ≦ 100

  • 0 ≦ T ≦ 100

  • The first test case is same as sample IO. It is suggest to use it to check whether your output format is valid.

Output

Please output how the classroom looks like in the T-th second (when t=T).

Sample Input  Download

Sample Output  Download

Tags




Discuss




13636 - Two Zero Two Four   

Description

 

You are very bored until you see the meme above while surfing social media. You come up with an idea and decide to do something to the digits lying on your discrete math homework. 

Here's what you are going to do:
Now you have a line, containing many digits. You want to turn the digits into the corresponding vocabulary, i.e. turned 1 into One, 2 into Two, 3 into Three ... and so on. Besides, you think it's annoying to see the same word repeat contiguously. Thus if there are adjacent digits that are the same, you would like to count the amount of them, output the amount, and then output their corresponding vocabulary. For example, 111 should be turned into ThreeOne, and 44 should be turned into TwoFour.

Due to some unknown reasons, the line contains not only digits but also many annoying spaces. They won't affect the answer and you should ignore them. 

It is guaranteed that there won't be more than 9 same contiguous digits.

 

0 <-> Zero
1 <-> One
2 <-> Two
3 <-> Three
4 <-> Four
5 <-> Five
6 <-> Six
7 <-> Seven
8 <-> Eight
9 <-> Nine

Input

A single line, contains only spaces and digits.

It is guaranteed that the length of the line would be less than 103.

Output

A single line, the transform result, contains letters and a '\n' at the end of the line.

Sample Input  Download

Sample Output  Download

Tags

1 FlyHighHigh B:0044



Discuss