#include<iostream>
using namespace std; int main() { //freopen("road.in","r",stdin); //freopen("road.out","w",stdout); long long n,d; long long k,h=0,i,l=0,m=0,v=0,y=0,s=1,s1=1; cin>>n>>d; int a[n],b[(n+1)]; for(i=1;i<n;i++) cin>>a[i]; for(i=1;i<=n;i++) cin>>b[i]; while(y==0){ h=0; for(i=(s+1);i<=n;i++){ if((b[i]<b[s])||(i==n)){ k=(i-s);break; } } for(i=1;i<=k;i++){ h=h+a[i]; s++; } h-=v; cout<<"h="<<h<<' '; l=h/d; if(h%d!=0)l++; cout<<"l="<<l<<' '; v+=l*d; m+=l*b[s1];
题目 4017 [NOI 2024]登山
2024-09-22 18:00:44
|