- 车队过桥问题
- 2016-12-14 17:41:32 @
Var
max,len,zl:int64;
min,sj,zc:double;
w,v:array[1..1000]of int64;
s:array[0..1000]of double;
n,i,j:integer;
Begin
readln(max,len,n);
for i:=1 to n do
readln(w[i],v[i]);
for i:=1 to n do
begin
sj:=len/v[i];
zl:=w[i];
min:=s[i-1]+len/v[i];
for j:=i-1 downto 1 do
if zl+w[j]>max then
break
else
begin
if len/v[j]>sj then
zc:=len/v[j]
else
zc:=sj;
if min>s[j-1]+zc then
begin
sj:=zc;
min:=s[j-1]+zc;
end;
zl:=zl+w[j];
end;
s[i]:=min;
end;
writeln(s[n]*60:0:1);
readln;
End.