~~同求~~
by 蔚兰飞雪 @ 2017-07-19 15:02:26
#~~1. 真的不知道~~
by 蔚兰飞雪 @ 2017-07-19 15:02:45
@ YLFX
```cpp
#include<bits/stdc++.h>
using namespace std;
struct car{
long long weight,speed;
double time;
}a[1001];
long long n,lon,most;
double dp[1001]={0};
int main(){
cin>>most>>lon>>n;
for (int i=1; i<=n; i++){
cin>>a[i].weight>>a[i].speed;
a[i].time=lon*1.0/a[i].speed;
// dp[i]=1.38242e306;
}
memset(dp,127,sizeof(dp));
dp[0]=0.0;
// cout<<endl;
// for (int i=1; i<=n; i++) cout<<dp[i]<<endl;
for (int i=1; i<=n; i++){
long long tw=0;
double mt=0.0;
for (int l=i; l>=1; l--){
if (tw+a[l].weight>most) break;
else tw+=a[l].weight;
mt=max(mt,a[l].time);
dp[i]=min(dp[i],dp[l-1]+mt);
}
}
dp[n]*=60.0;
cout<<fixed<<setprecision(1);
cout<<dp[n];
return 0;
}
(后来发现dp数组的初始值不够大,要设置为int的最大值。。。)
```
by 斗蜂 @ 2017-07-19 21:11:08
好吧╮(╯-╰)╭我也是
解锁新的错误姿势
by Kaizyn @ 2018-08-23 17:17:17