记录编号 |
21486 |
评测结果 |
TTTTTTTTEE |
题目名称 |
YL杯超级篮球赛 |
最终得分 |
0 |
用户昵称 |
1102 |
是否通过 |
未通过 |
代码语言 |
Pascal |
运行时间 |
8.516 s |
提交时间 |
2010-11-11 08:11:17 |
内存使用 |
7.91 MiB |
显示代码纯文本
program xxx;
var n,i,j,k,l,b:longint;
a:array[1..10000] of real;
aa:array[1..10000,1..2] of longint;
f:array[0..1000,0..1000] of real;
w:real;
function min(a1,a2:real):real;
begin
if a1<a2 then
min:=a1
else
min:=a2;
end;
begin
assign(input,'ballc.in');
reset(input);
assign(output,'ballc.out');
rewrite(output);
read(n);
for i:=1 to n do
read(a[i]);
l:=maxlongint;
for i:=1 to n do
begin
read(aa[i,1],aa[i,2]);
if aa[i,1]<l then
l:=aa[i,1];
if aa[i,2]<1 then
l:=aa[i,2];
if aa[i,2]>b then
b:=aa[i,2];
if aa[i,1]>b then
b:=aa[i,1];
end;
w:=200000000;
for i:=l to b do
for j:=l to b do
begin
for k:=1 to n do
begin
f[i,j]:=f[i,j]+a[k]*(abs(i-aa[k,1])+abs(j-aa[k,2]));
end;
w:=min(f[i,j],w);
if w=0 then
begin
write('0.00');
close(input);
close(output);
halt;
end;
end;
write(w:0:2);
close(input);
close(output);
end.