#include
<
iostream
>
using
namespace
std;
int
Max,s,n;
double
w[
1010
],c[
1010
];
double
f[
1010
];
int
main()
{
scanf(
"
%d%d%d
"
,
&
Max,
&
s,
&
n);
w[
0
]
=
c[
0
]
=
f[
0
]
=
0.0
;
for
(
int
i
=
1
;i
<=
n;
++
i){
scanf(
"
%lf%lf
"
,
&
w[i],
&
c[i]);
f[i]
=
f[i
-
1
]
+
s
/
c[i];
w[i]
+=
w[i
-
1
];
double
Min
=
c[i];
for
(
int
j
=
i
-
1
;j
>=
1
;
--
j)
if
(w[i]
-
w[j
-
1
]
<=
(
double
)Max){
if
(Min
>
c[j])
Min
=
c[j];
if
(f[i]
>
f[j
-
1
]
+
s
/
Min)
f[i]
=
f[j
-
1
]
+
s
/
Min;
}
else
break
;
}
f[n]
=
f[n]
*
60.0
;
printf(
"
%0.1lf\n
"
,f[n]);
return
0
;
}
posted on 2009-05-01 16:02
xfstart07 阅读(184)
评论(0) 编辑 收藏 引用 所属分类:
代码库