讨论 / 搞不懂……谁来看看我哪里错了
Zx.MYS 2008-08-24 21:32:00
点我顶贴 收藏 删除
program rqnoj_249;

var

ga,g2:array[0..101,0..101] of boolean;

n,m,a,b,j,i,t:longint;

c:string[1];

function check(x,y:longint):longint;

var

zz,zy,zx:longint;

begin

zx:=0;

for zz:=-1 to 1 do

for zy:=-1 to 1 do

if not((zz=0)and(zy=0)) then

if ga[x+zz,y+zy] then inc(zx);

check:=zx;

end;

begin

fillchar(ga,sizeof(ga),0);

readln(m,n,t);

for i:= 1 to n do

begin

for j:= 1 to m do

begin

read(c);

if c=’1’ then ga[i,j]:=true;

end;

readln;

end;

g2:=ga;

for a:= 1 to t-1 do

begin

for i:= 1 to n do

for j:= 1 to m do

begin

b:=check(i,j);

if (ga[i,j]) and (b<2) then g2[i,j]:=false;

if (ga[i,j]) and (b>3) then g2[i,j]:=false;

if not(ga[i,j]) and (b=3) then g2[i,j]:=true;

end;

ga:=g2;

end;

for i:= 1 to n do

begin

for j:= 1 to m do

if ga[i,j] then write(1) else write(0);

writeln;

end;

end.

最后莫名其妙的全输出0……囧……在我本机上一点问题也没有啊。

#1 Zx.MYS@2008-08-16 10:39:00
回复 删除
靠~把c:string[1]改成c:char就AC

囧!!!!!

PS:这里的FP是什么版本的???

#2 Zx.MYS_II@2008-08-16 10:40:00
回复 删除
自己搞定,分就不发啦。
#3 woshiniba@2008-08-16 17:43:00
回复 删除
我写的也是ch:char;

一堆0……

#4 Jollwish@2008-08-24 21:32:00
回复 删除
当然,

string一读就是一行,你不能一个字符一个字符地读

查看更多回复
提交回复