比赛 20091026 评测结果 AAAAEEAEWA
题目名称 抗震救灾 最终得分 60
用户昵称 ReimBurSe. 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2009-10-26 21:00:00
显示代码纯文本
Program savez;

Type
sc=array [1..5000] of int64;
sc1=array [1..5000] of string;

Var
a,b:sc;
s:sc1;
i,j,n:longint;
min,temp,temp1:longint;
mins:string;
c:char;

Begin
assign(input,'savez.in');
assign(output,'savez.out');
reset(input);
rewrite(output);
n:=1;
while not(eof(input)) do begin
 readln(a[n],b[n],c,s[n]);
 n:=n+1;
end;
n:=n-1;
temp:=0;
for i:=2 to n do begin
 temp1:=(b[1]-b[i])*a[i];
 if temp1<0 then temp1:=temp1*(-1);
 temp:=temp+temp1;
end;
min:=temp;
mins:=s[1];
for i:=2 to n do begin
 temp:=0;
 for j:=1 to (i-1) do begin
  temp1:=(b[i]-b[j])*a[j];
  if temp1<0 then temp1:=temp1*(-1);
  temp:=temp+temp1;
 end;
 for j:=(i+1) to n do begin
  temp1:=(b[i]-b[j])*a[j];
  if temp1<0 then temp1:=temp1*(-1);
  temp:=temp+temp1;
 end;
 if temp<min then begin
  min:=temp;
  mins:=s[i];
 end;
end;
writeln(mins);
close(input);
close(output);
End.