记录编号 78278 评测结果 AAAAAAAAAA
题目名称 [POJ1657] 棋盘上的距离 最终得分 100
用户昵称 Gravatar铁策 是否通过 通过
代码语言 Pascal 运行时间 0.001 s
提交时间 2013-11-03 18:28:45 内存使用 0.17 MiB
显示代码纯文本
program P800;
var
s:string;
t,i,j,k,x1,y1,x2,y2:longint;
begin
assign(input,'poj_1657.in');
reset(input);
assign(output,'poj_1657.out');
rewrite(output);
readln(t);
for i:=1 to t do
begin
readln(s);
x1:=ord(s[2])-48;
x2:=ord(s[5])-48;
y1:=ord(s[1])-96;
y2:=ord(s[4])-96;
if (x1=x2)and(y1=y2) then writeln('0 0 0 0') else begin
if abs(x1-x2)>=abs(y1-y2) then write(abs(x1-x2),' ') else write(abs(y1-y2),' ');
if (abs(x1-x2)=abs(y1-y2))or(x1=x2)or(y1=y2) then write('1 ') else write('2 ');
if (x1=x2)or(y1=y2) then write('1 ') else write('2 ');
if ((x1+y1) mod 2)<>((x2+y2) mod 2) then writeln('Inf') else
if (x1-y1=x2-y2)or(x1+y1=x2+y2) then writeln(1) else writeln(2);
end;
end;
end.