📄 problem 1051.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0047)http://acm.zju.edu.cn/show_problem.php?pid=1051 -->
<HTML><HEAD><TITLE>Problem 1051</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2900.3157" name=GENERATOR></HEAD>
<BODY>
<CENTER><IMG src="Problem 1051.files/logo.gif" align=center></IMG></CENTER>
<HR>
<CENTER><FONT color=blue size=+2>A New Growth Industry</FONT></CENTER>
<HR>
<CENTER><FONT color=green>Time limit:</FONT> 1 Seconds <FONT
color=green>Memory limit: </FONT>32768K </FONT><BR><FONT
color=green>Total Submit:</FONT> 2335 <FONT color=green>Accepted
Submit:</FONT> 803 </CENTER>
<HR>
<P><IMG height=169 src="Problem 1051.files/showimg.gif" width=174></P>
<P>A biologist experimenting with DNA modification of bacteria has found a way
to make bacterial colonies sensitive to the <BR>surrounding population density.
By changing the DNA, he is able to “program” the bacteria to respond to the
varying densities in their immediate neighborhood. <BR><BR>The culture dish is a
square, divided into 400 smaller squares (20x20). Population in each small
square is measured on a four point scale (from 0 to 3). The DNA information is
represented as an array D, indexed from 0 to 15, of integer values and is
interpreted as follows: <BR><BR>In any given culture dish square, let K be the
sum of that square's density and the densities of the four squares immediately
to the left, right, above and below that square (squares outside the dish are
considered to have density 0). Then, by the next day, that dish square's density
will change by D[K] (which may be a positive, negative, or zero value). The
total density cannot, however, exceed 3 nor drop below 0. <BR><BR>Now, clearly,
some DNA programs cause all the bacteria to die off (e.g., [-3, -3, …, -3]).
Others result in immediate population explosions (e.g., [3,3,3, …, 3]), and
others are just plain boring (e.g., [0, 0, … 0]). The biologist is interested in
how some of the less obvious DNA programs might behave. <BR><BR>Write a program
to simulate the culture growth, reading in the number of days to be simulated,
the DNA rules, and the initial population densities of the dish.
<BR><B><BR></B><B><BR>Input Format: </B><BR><BR>Input to this program consists
of three parts: <BR><BR>1. The first line will contain a single integer denoting
the number of days to be simulated. <BR><BR>2. The second line will contain the
DNA rule D as 16 integer values, ordered from D[0] to D[15], separated from one
another by one or more blanks. Each integer will be in the range -3…3,
inclusive. <BR><BR>3. The remaining twenty lines of input will describe the
initial population density in the culture dish. Each line describes one row of
squares in the culture dish, and will contain 20 integers in the range 0…3,
separated from one another by 1 or more blanks. </P>
<P><BR><B>Output Format:</B> <BR><BR>The program will produce exactly 20 lines
of output, describing the population densities in the culture dish at the end of
the simulation. Each line represents a row of squares in the culture dish, and
will consist of 20 characters, plus the usual end-of-line terminator.
<BR><BR>Each character will represent the population density at a single dish
square, as follows: </P>
<P align=center><IMG height=127
src="E:\ACM\ZJU\现在做的题\1051\Problem 1051.files\showimg(1).gif" width=202><BR></P>
<P align=left>No other characters may appear in the output. <BR></P>
<P align=left><BR><B>This problem contains multiple test cases!</B></P>
<P>The first line of a multiple input is an integer N, then a blank line
followed by N input blocks. Each input block is in the format indicated in the
problem description. There is a blank line between input blocks.</P>
<P>The output format consists of N output blocks. There is a blank line between
output blocks.</P>
<P align=left><BR><B>Sample Input: </B><BR><BR>1<BR><BR>2 <BR>0 1 1 1 2 1 0 -1
-1 -1 -2 -2 -3 -3 -3 -3 <BR>3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 <BR>0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 <BR>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
<BR>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 <BR>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 <BR>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 <BR>0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 <BR>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 <BR>0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 <BR>0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 <BR>0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 <BR>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
<BR>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 <BR>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 <BR>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 <BR>0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 <BR>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 <BR>0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 <BR>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 <BR>0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 </P>
<P align=left><BR><B>Sample Output:</B> <BR><BR>##!.................
<BR>#!.................. <BR>!................... <BR>....................
<BR>.................... <BR>.................... <BR>....................
<BR>.........!.......... <BR>........!#!......... <BR>.......!#X#!........
<BR>........!#!......... <BR>.........!.......... <BR>....................
<BR>.................... <BR>.................... <BR>....................
<BR>.................... <BR>.................... <BR>....................
<BR>.................... </P>
<HR>
<FONT color=green size=+1>Problem Source: </FONT><I>Mid-Atlantic USA 2001</I>
<HR>
<CENTER><A href="http://acm.zju.edu.cn/submit.php?pid=1051">Submit</A>
<A href="http://acm.zju.edu.cn/list_problem.php?vol=1">Back</A>
<A
href="http://acm.zju.edu.cn/problem_status.php?pid=1051">Status</A> </CENTER>
<HR>
<CENTER>
<TABLE width="100%" border=0>
<TBODY>
<TR>
<TD align=right width="65%"><A href="http://acm.zju.edu.cn/"><FONT
color=red>Zhejiang University Online Judge</FONT></A> <A
href="http://acm.zju.edu.cn/"><FONT color=red>V1.0</FONT></A></TD>
<TD align=right width="35%"><A href="http://www.zzhang.cn/"><FONT
color=#ffffff
size=-3>Book</FONT></A></TD></TR></TBODY></TABLE></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -