Re: Need Your Help with test #22
Послано
hoan 23 дек 2010 21:56
try this test:
input:
a1
h8
a3
h6
a5
h4
a7
h2
b2
g7
b4
g5
b6
g3
b8
g1
c1
f8
c3
f6
c5
f4
c7
f2
d2
e7
d4
e5
d6
e3
d8
e1
output:
Draw
first my code write 31.
Re: Need Your Help with test #22
program ural1334;
const
dx:array[1..8]of shortint=(-1,-1,-1,0,1,1,1,0);
dy:array[1..8]of shortint=(-1,0,1,1,1,0,-1,-1);
var
a:array[0..9,0..9]of byte;
i,x,y,d:byte;
c:char;
begin
fillchar(a,sizeof(a),2);
for i:=1 to 32 do begin
readln(c,y);
x:=ord(c)-96;
for d:=1 to 8 do
if a[x+dx[d],y+dy[d]]+i and 1=1 then begin
writeln(i);
halt;
end;
a[x,y]:=i and 1;
end;
writeln('Draw');
end.