比赛 noip20081103 评测结果 AAAATTTTTA
题目名称 奶酪工厂 最终得分 50
用户昵称 E.M.B.E.R 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-11-03 21:01:34
显示代码纯文本
program EmberAsh;
var
i,j,n,s:longint;
a:array[0..10000,1..2]of int64;
f:array[0..10000]of int64;
k,min:int64;
fin,fout:text;

BEGIN
assign(fin,'factory.in');reset(fin);
assign(fout,'factory.out');rewrite(fout);
readln(fin,n,s);
for i:=1 to n do
  readln(fin,a[i,1],a[i,2]);
//min:=maxlongint;
for i:=1 to n do
  begin
  for j:=1 to i do
    begin
    k:=a[j,1]*a[i,2]+(i-j)*a[i,2]*s;
    if (k<f[i])or(f[i]=0) then
      f[i]:=k;
    end;
  end;
{for i:=1 to n do//第n件物品
  begin
  for j:=1 to i-1 do
    begin
    k:=
    end;
  end;}
min:=0;
for i:=1 to n do
  min:=min+f[i];
writeln(fout,min);
close(fin);close(fout);
END.