-->
当前位置:首页 > 题库

PROGRAMMING:Reproduction and diffusion of bacteria

Luz5年前 (2021-05-10)题库471
###Task description
In the square dish with 9 sides, there are m bacteria in the center. Suppose that the life span of bacteria is only one day, but it can produce 10 progenies every day. Among these 10 progenies, two are distributed in the original cells, and the rest are evenly distributed in eight adjacent cells. The distribution of bacteria in the culture dish after n (1 ≤ n ≤ 4) days was calculated.
###Input format:
The first integer m is the number of bacteria in the center (2 ≤ m ≤ 30), and the second integer n is the number of days (1 ≤ n ≤ 4).
###Output format:
Output nine rows and nine columns of integer matrix, the integers in each row are separated by spaces. The whole matrix represents the distribution of bacteria on the Petri dish after n days.
###Input example:
```in
2 1
```
###Output example:
```out
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 2 2 2 0 0 0
0 0 0 2 4 2 0 0 0
0 0 0 2 2 2 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
```
###Title Source
This topic is selected from openjudge website http://noi.openjudge.cn/ch0108/01/






answer:If there is no answer, please comment