比赛 20101110 评测结果 WWWWTTTTTT
题目名称 YL杯超级篮球赛 最终得分 0
用户昵称 wo shi 刘畅 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2010-11-10 20:35:14
显示代码纯文本
var
  n,i,x,y:longint;
  total,min:real;
  a:array[0..1000000,1..2]of longint;
  w:array[0..1000000]of longint;

procedure init;
begin
  assign(input,'ballc.in'); reset(input);
  assign(output,'ballc.out'); rewrite(output);
  readln(n);
  for i:=1 to n do read(w[i]);
  for i:=1 to n do readln(a[i,1],a[i,2]);
  min:=maxlongint;
end;

begin
  init;
  for x:=0 to 100 do
   for y:=0 to 100 do
   begin
     total:=0;
     for i:=1 to n do
     total:=total+w[i]*(abs(x-a[i,1])+abs(y-a[i,2]));
     if total<min then min:=total;
   end;
  writeln(min:0:2);
  close(input);
  close(output);
end.