很显然错了
0 0 0
1 0 1
0 0 0
by cbx8888 @ 2016-01-14 14:11:46
if
000000000000000
111111111111111
100000000000001
100000111111001
1000001[/b]0[/b]0[/b]0[/b]0[/b]1001
111111100001111
by Qweg @ 2016-01-24 16:25:37
000000000000000
111111111111111
100000000000001
100000111111001
100000100001001
111111100001111
by Qweg @ 2016-01-24 16:26:52
const dic:array[1..4,1..2]of longint=((-1,0),(0,-1),(1,0),(0,1));
```cpp
var a:array[0..40,0..40]of longint;
q:array[1..30*30+1,1..2]of longint;
i,j,k,l,m,n,ans,x,y:longint;
procedure print(x,y:longint);
var h,l,nh,nl,t,w,i:longint;
begin
t:=0;
w:=1;
fillchar(q,sizeof(q),0);
a[x,y]:=3;
q[w,1]:=x;
q[w,2]:=y;
while t<w do
begin
inc(t);
h:=q[t,1];
l:=q[t,2];
for i:=1 to 4 do
begin
nh:=h+dic[i,1];
nl:=l+dic[i,2];
if a[nh,nl]=0 then
begin
inc(w);
a[nh,nl]:=3;
q[w,1]:=nh;
q[w,2]:=nl;
end;
end;
end;
end;
begin
readln(n);
for i:=0 to 40 do
for j:=0 to 40 do
a[i,j]:=3;
for i:=1 to n do
for j:=1 to n do
read(a[i,j]);
for i:=1 to n do
begin
if a[1,i]=0 then print(1,i);
if a[i,1]=0 then print(i,1);
if a[i,n]=0 then print(i,n);
if a[n,i]=0 then print(n,i);
end;
for i:=1 to n do
begin
for j:=1 to n do
begin
case a[i,j] of
3:write(0,' ');
1:write(1,' ');
else write(2,' ');
end;
end;
writeln;
end;
end.
```
用 0123表示
by Additi0n @ 2016-08-11 12:17:52