Help!Help!!Help!!!
Послано
New CD 19 дек 2002 18:22
{$n+}
program ti;
const fx:array[1..4,1..2]of -1..1=((-1,0),(0,1),(1,0),(0,-1));
var total,n,i,j:longint;
ch:char;
answer:extended;
a:array[0..40,0..40]of integer;
procedure cl(x,y:longint);
var i:integer;
begin
a[x,y]:=2;
for i:=1 to 4 do if a[x+fx[i,1],y+fx[i,2]]=0 then begin
cl(x+fx[i,1],y+fx[i,2]);
end else if a[x+fx[i,1],y+fx[i,2]]=1 then total:=total+1;
end;
begin
readln(n);
for i:=1 to n do begin
for j:=1 to n do begin
read(ch);
if ch='*' then a[i,j]:=1
else a[i,j]:=0;
end;
readln;
end;
for i:=1 to n do begin
a[0,i]:=1;
a[i,0]:=1;
a[i,n+1]:=1;
a[n+1,i]:=1;
end;
total:=-4;
cl(1,1);
answer:=total*9;
write(answer:0:0);
end.
Re: Help!Help!!Help!!!
You've done one stupid mistake, all right: in the end you say total:=-
4 instead of total:=total-4; . I believe this is the thing... else it
should work (i don't know for sure, i didn't check the rest of it).