请问哪里错了?

program zx00;

var

a:array[0..501,0..501] of 0..2;

tot,n,bb,i,m,j,x,y:longint;

ch:char;

procedure fanlan(p,q:integer);

begin

a[p,q]:=1;

if a[p-1,q]=0 then fanlan(p-1,q);

if a[p+1,q]=0 then fanlan(p+1,q);

if a[p,q+1]=0 then fanlan(p,q+1);

if a[p,q-1]=0 then fanlan(p,q-1);

end;

begin

readln(x,y);

for i:=1 to x do

begin

for j:=1 to y-1 do

begin

read(ch);

if ch='0' then a:=0 else a:=2; {0代表未知,1代表是水,2代表墙,}

read(ch);

end;

readln(ch);

if ch='0' then a:=0 else a:=2;

end;

for i:=0 to x+1 do

begin

a[0,i]:=1;

a[x+1,i]:=1;

end;

for i:=1 to y do

begin

a:=1;a:=1;

end;

for i:=1 to x do

for j:=1 to y do

if (a=0) and((a=1)or(a=1)or(a=1)or(a=1))then fanlan(i,j);

for i:=1 to x do

for j:=1 to y do

if a=0 then tot:=tot+1;

writeln(tot);

end.

4 条评论

  • @ 2015-02-15 09:40:43

    var a,v:array[0..501,0..501] of longint;
    i,j,k,l,m,n,sbwen:longint;
    t:char;
    procedure dfs(x,y:longint);
    var g,t,s:longint;
    begin
    if a[x,y]=0 then begin a[x,y]:=1;
    if a[x,y+1]=0 then dfs(x,y+1);
    if a[x,y-1]=0 then dfs(x,y-1);
    if a[x+1,y]=0 then dfs(x+1,y);
    if a[x-1,y]=0 then dfs(x-1,y); end;
    end;
    begin
    readln(m,n);
    for i:=1 to m do begin
    for j:=1 to n do begin read(t);
    if t='*' then
    a:=1; end; readln;
    end;
    for i:=1 to m do begin a:=1;a:=1; end;
    for i:=1 to n do begin a[0,i]:=1;a[m+1,i]:=1; end;
    for i:=1 to m do begin dfs(i,1);dfs(i,n); end;
    for i:=1 to n do begin dfs(1,i);dfs(m,i); end;
    for i:=1 to m do
    for j:=1 to n do
    if a=0 then inc(sbwen);
    writeln(sbwen);
    end.

  • @ 2014-02-26 16:52:49

    d
    dd
    d
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd
    ddd

  • @ 2014-02-26 16:52:17

    sxs

    dssd

  • @ 2014-02-26 16:51:57
  • 1

信息

ID
1294
难度
6
分类
搜索 点击显示
标签
(无)
递交数
1840
已通过
556
通过率
30%
被复制
3
上传者