比赛 20111102 评测结果 AAAAAAAAAA
题目名称 麻烦的干草打包机 最终得分 100
用户昵称 reamb 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2011-11-02 19:09:21
显示代码纯文本
program mafandegancaodabaoji;
var
  n,i,j,qidong,work,t,w,d:longint;
  xt,yt:real;
  father,team:array[0..1050]of longint;
  zhuansu,x,y,r,f:array[1..1050] of real;
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 (x[i],y[i],r[i]);
      if (x[i]=0)and(y[i]=0) then
        qidong:=i;
      if (x[i]=xt)and(y[i]=yt) then
        work:=i
    end;
    team[1]:=qidong;
    f[1]:=10000;
    zhuansu[1]:=10000;
    father[1]:=0;
    t:=1;
    w:=1;
    if (xt=0)and(yt=0) then
      writeln (10000);
    repeat
      d:=team[t];
      for i:=1 to n do
        if (i<>team[father[t]])
        and (sqr(x[d]-x[i])+sqr(y[d]-y[i])=sqr(r[d]+r[i])) then
        begin
          w:=w+1;
          team[w]:=i;
          zhuansu[w]:=zhuansu[t]*r[d]/r[i];
          father[w]:=t;
          f[w]:=f[t]+zhuansu[w];
          if i=work then
          begin
            writeln (trunc(f[w]));
            close (input);
            close (output);
            halt
          end
        end;
      t:=t+1
    until false;
  close (input);
  close (output)
end.