讨论 / 求解释!!!,貌似没看错题,但为啥不过??
a6622868 2011-11-30 19:32:00
点我顶贴 收藏 删除
代码如下:

var

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

s:string;

a,b:array [1..1000,1..1000] of 0..1;

begin

readln(m,n,t);

for i:=1 to n do

begin

readln(s);

for j:=1 to m do

a[i,j]:=ord(s[j])-ord('0');

end;

for i:=1 to t-1 do

begin

for j:=1 to n do

for k:=1 to m do

begin

tot:=0;

if a[j,k]=0 then

begin

if (j>1) and (a[j-1,k]=1) then inc(tot);

if (k>1) and (a[j,k-1]=1) then inc(tot);

if (j<n) and (a[j+1,k]=1) then inc(tot);

if (k>m) and (a[j,k+1]=1) then inc(tot);

if (j>1) and (k>1) and (a[j-1,k-1]=1) then inc(tot);

if (j<n) and (k<m) and (a[j+1,k+1]=1) then inc(tot);

if (j>1) and (k<m) and (a[j-1,k+1]=1) then inc(tot);

if (j<n) and (k>1) and (a[j+1,k-1]=1) then inc(tot);

if tot=3 then b[j,k]:=1

else b[j,k]:=0;

end

else

begin

if (j>1) and (a[j-1,k]=1) then inc(tot);

if (k>1) and (a[j,k-1]=1) then inc(tot);

if (j<n) and (a[j+1,k]=1) then inc(tot);

if (k>m) and (a[j,k+1]=1) then inc(tot);

if (j>1) and (k>1) and (a[j-1,k-1]=1) then inc(tot);

if (j<n) and (k<m) and (a[j+1,k+1]=1) then inc(tot);

if (j>1) and (k<m) and (a[j-1,k+1]=1) then inc(tot);

if (j<n) and (k>1) and (a[j+1,k-1]=1) then inc(tot);

if (tot=3) or (tot=2) then b[j,k]:=1

else b[j,k]:=0;

end;

end;

a:=b;

end;

for i:=1 to n do

begin

for j:=1 to m do

write(a[i,j]);

writeln;

end;

readln;

readln

end.

#1 a6622868@2011-11-30 00:37:00
回复 删除
晕哦~~

竟然将'<'写成'>' 已成功AC 这一分先到先得 就当+RP了(分貌似不多。。。)

#2 ?号疯子(第四代)@2011-11-30 03:59:00
回复 删除
无语

……(有时候,自己找错误;找不到,再发上来吧……)

#3 ?号疯子(第四代)@2011-11-30 03:59:00
回复 删除
无语

……(有时候,自己找错误;找不到,再发上来吧……)

#4 ?号疯子(第四代)@2011-11-30 04:00:00
回复 删除
啊,不小心发了两个
#5 a6622868@2011-11-30 18:51:00
回复 删除
不好意思哦~~

有时候很懒。。。分给你了啊

#6 ?号疯子(第四代)@2011-11-30 19:32:00
回复 删除
查看更多回复
提交回复