记录编号 79432 评测结果 AAAAAAAAAA
题目名称 [USACO Mar08] 麻烦的干草打包机 最终得分 100
用户昵称 Gravatar, 是否通过 通过
代码语言 Pascal 运行时间 0.042 s
提交时间 2013-11-05 18:09:25 内存使用 15.62 MiB
显示代码纯文本
program gmy(input,output);
var
 a:array[1..10000,1..2]of longint;
 b,c:array[1..10000]of longint;
 d:array[1..2000,0..2000]of longint;
 e:array[1..10000]of longint;
 n,i,j,xt,yt,js,qd:longint;
 shu:real;
procedure try(k,l:longint);
var
 j:longint;
begin
 if k=js then begin
               shu:=0;
               for j:=1 to l-1 do
                 shu:=shu+10000*b[qd]/b[e[j]];
               writeln(shu:0:0);
               close(input);
               close(output);
               halt;
              end;
 c[k]:=1;
 for j:=1 to d[k,0] do
   if c[d[k,j]]=0 then begin
                        e[l]:=d[k,j];
                        try(e[l],l+1);
                        e[l]:=0;
                       end;
end;
begin
 assign(input,'baler.in');
 reset(input);
 assign(output,'baler.out');
 rewrite(output);
 readln(n,xt,yt);
 for i:=1 to n do
   begin
    readln(a[i,1],a[i,2],b[i]);
    if (a[i,1]=xt) and (a[i,2]=yt) then js:=i;
    if (a[i,1]=0) and (a[i,2]=0) then qd:=i;
   end;
 for i:=1 to n do
   for j:=i+1 to n do
     if sqr(a[i,1]-a[j,1])+sqr(a[i,2]-a[j,2])=sqr(b[i]+b[j])
     then begin
           d[i,0]:=d[i,0]+1;
           d[i,d[i,0]]:=j;
           d[j,0]:=d[j,0]+1;
           d[j,d[j,0]]:=i;
          end;
 fillchar(c,sizeof(c),0);
 e[1]:=qd;
 try(qd,2);
end.