讨论 / why wrong?????
!@#$% 2010-07-16 06:08:00
点我顶贴 收藏 删除
var a,b:array [0..101,0..101] of integer;

i,j,k,n,m,t:longint;

s:string;

function get_active(i,j:longint):longint;

begin

if a[i+1,j]=1 then inc(get_active);

if a[i-1,j]=1 then inc(get_active);

if a[i,j+1]=1 then inc(get_active);

if a[i,j-1]=1 then inc(get_active);

if a[i+1,j+1]=1 then inc(get_active);

if a[i-1,j-1]=1 then inc(get_active);

if a[i+1,j-1]=1 then inc(get_active);

if a[i-1,j+1]=1 then inc(get_active);

end;

begin

readln(m,n,t);

for i:=1 to m do

begin

readln(s);

for j:=1 to n do a[i,j]:=ord(s[j])-48;

end;

{writeln;}

for i:=1 to m do

begin

a[i,0]:=2;

a[i,n+1]:=2;

end;

for i:=1 to n do

begin

a[0,i]:=2;

a[m+1,i]:=2;

end;

for k:=2 to t do begin

for i:=1 to m do

for j:=1 to n do

begin

if a[i,j]=1 then

case get_active(i,j) of

0,1,4,5,6,7,8:b[i,j]:=0;

2,3:b[i,j]:=1; end

else begin

if get_active(i,j)=3 then b[i,j]:=1 else b[i,j]:=0; end;

end;

a:=b;

end;

for i:=1 to m do

begin

for j:=1 to n do write(a[i,j]);

writeln;

end;

readln;

end.

#1 jerryR1@2010-07-16 06:08:00
回复 删除
大牛,你也该发发题号呀,要不咋知道呢????
查看更多回复
提交回复