比赛 20110724 评测结果 AAATTTATTT
题目名称 遥远的距离 最终得分 40
用户昵称 echo 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2011-07-24 11:17:56
显示代码纯文本
program faraway;
var
  t,n,m,i,j,k:longint;
  ax,ay,bx,by:array[1..100000] of double;
  ans,max:double;

function dis(i,j:longint):double;
  begin
    dis:=sqrt(sqr(by[j]-ay[i])+sqr(bx[j]-ax[i]));
  end;

procedure work;
begin
      max:=-1;
      readln(n,m);
      for j:=1 to n do
        readln(ax[j],ay[j]);
      for j:=1 to m do
        readln(bx[j],by[j]);
      for k:=1 to n do
        for j:=1 to m do
          begin
            ans:=dis(k,j);
            if ans>max then max:=ans;
          end;
      writeln(max:0:3);
end;

begin
  assign(input,'faraway.in');
  assign(output,'faraway.out');
  reset(input);
  rewrite(output);
  readln(t);
  for i:=1 to t do
    work;
  close(input);
  close(output);
end.