比赛 20091026 评测结果 WWWWEEWEWA
题目名称 抗震救灾 最终得分 10
用户昵称 .Xmz 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2009-10-26 19:46:04
显示代码纯文本
program xmz;
{type
gao=array[1..10]of longint;}
var
f1,f2:text;
r:array[1..5000]of integer;
s:array[1..5000]of int64;
st:string;
mz:array[1..5000]of string;
zr,yr:array[1..5000]of longint;
zd,yd:array[1..5000]of int64;
max:int64;
a,n,maxx:longint;

begin
 assign(f1,'savez.in');assign(f2,'savez.out');
 reset(f1);rewrite(f2);
 repeat
  n:=n+1;
  read(f1,r[n],s[n]);
  readln(f1,mz[n]);
 until eof(f1);

 for a:=2 to n do
  begin
  zr[a]:=zr[a-1]+r[a-1];
  zd[a]:=zd[a-1]+abs(s[a]-s[a-1])*zr[a];
  end;
 for a:=n-1 downto 1 do
  begin
   yr[a]:=yr[a+1]+r[a+1];
   yd[a]:=yd[a+1]+abs(s[a]-s[a+1])*yr[a];
  end;

 max:=yd[1]+zd[1];
 for a:=1 to n do
  if yd[a]+zd[a]<max then begin max:=yd[a]+zd[a];maxx:=a;end;
 for a:=2 to length(mz[maxx]) do
 write(f2,mz[maxx][a]);
 close(f1);close(f2);
end.