Gravatar
6b6b6b6
积分:78
提交:53 / 64
#include<cstdio>
#include<iostream>
using namespace std;
long long n,d,v[114514],a[114514],cheap=11451419,fuel=0,money=0;
int main(){
freopen("road.in","r",stdin);
freopen("road.out","w",stdout);
cin>>n>>d;
for(int q=1;q<n;++q){
cin>>v[q];
}
for(int w=1;w<=n;++w){
cin>>a[w];
}
for(int e=1;e<n;++e){
if(a[e]<cheap) cheap=a[e];
while(fuel<v[e]){
fuel+=d;
money+=cheap;
}
fuel-=v[e];
}
cout<<money;

Gravatar
GS53
积分:41
提交:17 / 66
不要相信int,也不要相信0x3f

Gravatar
王和谐
积分:67
提交:44 / 175
三年oi一场空,不开long long 见祖宗

题目 3928 [CSP 2023J]公路
2023-10-30 21:20:18