比赛 noip20081103 评测结果 AAWWWWWWWA
题目名称 放养奶牛 最终得分 30
用户昵称 E.M.B.E.R 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-11-03 19:44:28
显示代码纯文本
program EmberAsh;
type
  node=record
    x:integer;
    y:integer;
    end;
var
a:array[0..100,1..40]of node;
cost:array[1..100]of integer;
f:array[1..100,1..100]of real;
i,j,n,m,x1,y1,x2,y2,ii,jj:longint;
min,k:real;
fin,fout:text;

BEGIN
assign(fin,'cowties.in');reset(fin);
assign(fout,'cowties.out');rewrite(fout);
readln(fin,n);
for i:=1 to n do
  begin
  read(fin,cost[i]);
  for j:=1 to cost[i] do
    read(fin,a[i,j].x,a[i,j].y);
  end;
for i:=1 to cost[n] do
  begin
  a[n+1,i].x:=a[n,i].x;
  a[n+1,i].y:=a[n,i].y;
  end;
for i:=1 to n do
  for j:=1 to n do
    if i<>j then
      for ii:=1 to cost[i] do
        for jj:=1 to cost[j] do
          begin
          x1:=a[i,ii].x;y1:=a[i,ii].y;
          x2:=a[j,jj].x;y2:=a[j,jj].y;
          k:=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
          if (f[i,j]>k)or(f[i,j]=0) then
            f[i,j]:=k;
          end;
min:=0;
for i:=1 to n-1 do
  min:=min+f[i,i+1];
min:=min+f[n,1];
writeln(fout,trunc(min*100));
close(fin);close(fout);
END.