比赛 |
NOIP_2 |
评测结果 |
WWWWWWWWWW |
题目名称 |
驾车旅行 |
最终得分 |
0 |
用户昵称 |
E.M.B.E.R |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2008-09-08 21:10:54 |
显示代码纯文本
program EmberAsh;
var
a:array[1..50]of longint;
b:array[1..50]of real;
jour,v,oil,cost,ss,still,t1,t2,t3,buy:real;
i,j,k,n:longint;
fin,fout:text;
BEGIN
assign(fin,'tour.in');reset(fin);
assign(fout,'tour.out');rewrite(fout);
readln(fin,jour);
readln(fin,v,oil,cost,n);
for i:=1 to n do
readln(fin,a[i],b[i]);
ss:=cost;
still:=v;
t1:=a[1];
t2:=t1/oil;
still:=still-t2;
for i:=2 to n do
begin
t1:=a[i]-a[i-1];
t2:=t1/oil;
if still<t2 then
begin
if b[i]>b[i-1] then
begin
buy:=v-still;
ss:=ss+20+buy*b[i-1];
still:=v;
end;
if b[i]<b[i-1] then
begin
t3:=v-still;
if 20+t3*b[i-1]<20+t3*b[i] then
begin
ss:=ss+20+t3*b[i-1];
still:=v;
end
else
begin
end;
end;
end;
if still>t2 then
begin
end;
end;
if still<jour-a[n] then
begin
t1:=jour-a[n];
t2:=t1/oil;
ss:=ss+20+t2*b[n];
end;
writeln(fout,ss:0:1);
close(fin);
close(fout);
END.