记录编号 12870 评测结果 AAAAWAAAAA
题目名称 护卫队 最终得分 90
用户昵称 Gravatarybh 是否通过 未通过
代码语言 Pascal 运行时间 0.143 s
提交时间 2009-09-22 20:18:59 内存使用 7.77 MiB
显示代码纯文本
program HuWeiDui;
const
  maxn=1000;
var
  f:array[0..maxn] of int64;
  sw:array[0..maxn] of int64;
  g:array[1..maxn,1..maxn] of int64;
  w,v:array[1..maxn] of longint;
  i,j,n:longint;
  m,l:int64;
  ww:int64;
  zhengshu:int64;
  xiaoshu,xiaoshu2,xiaoshu1:int64;
begin
  assign(input,'convoy.in');
  reset(input);
  assign(output,'convoy.out');
  rewrite(output);
  readln(m,l,n);
  l:=l*1000000;
  for i:=1 to n do
  begin
    readln(w[i],v[i]);
    g[i,i]:=v[i];
    sw[i]:=sw[i-1]+w[i]
  end;
  for i:=1 to n-1 do
    for j:=i+1 to n do
    begin
      if v[j]<g[i,j-1]
        then g[i,j]:=v[j]
        else g[i,j]:=g[i,j-1];
    end;
  for i:=1 to n do
  begin
    ww:=sw[i];
    for j:=0 to i-1 do
    begin
      if ww<=m then
      begin
        if f[i]=0 then
        begin
          f[i]:=f[j]+l div g[j+1,i]
        end
        else
        begin
          if f[i]>f[j]+l div g[j+1,i] then
          begin
            f[i]:=f[j]+l div g[j+1,i]
          end
        end
      end;
      ww:=ww-w[j+1]
    end
  end;
  zhengshu:=(f[n]*60) div 1000000;
  xiaoshu:=(f[n]*60) mod 1000000;
  xiaoshu1:=xiaoshu div 100000;
  xiaoshu2:=xiaoshu div 10000;
  xiaoshu2:=xiaoshu2 mod 10;
  if xiaoshu2>=5 then xiaoshu1:=xiaoshu1+1;
  if xiaoshu1>=10 then
  begin
    zhengshu:=zhengshu+1;
    xiaoshu1:=0
  end;
  writeln(zhengshu,'.',xiaoshu1);
  close(input);
  close(output)
end.