比赛 noip20081103 评测结果 AAAAAAAAAA
题目名称 奶酪工厂 最终得分 100
用户昵称 王瑞祥K 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-11-03 20:15:54
显示代码纯文本
program factory(input,output);
var
 week:array[1..10000]of int64;
 cost,need:array[1..10000]of integer;
 n,s,i,j:integer;
 tot:int64;
procedure ini;
var i:integer;
begin
 assign(input,'factory.in');assign(output,'factory.out');
 reset(input);rewrite(output);
 readln(n,s);
 for i:=1 to n do
  readln(cost[i],need[i]);
 for i:=1 to n do week[i]:=9999999999999;
end;
begin
 ini;
 for i:=1 to n do
  for j:=i to n do
   if ((j-i)*s+cost[i])<week[j] then week[j]:=(j-i)*s+cost[i];
 tot:=0;
 for i:=1 to n do
  tot:=tot+week[i]*need[i];
 write(tot);
 close(input);close(output);
end.