标签:pre div 图片 clu 技术 cstring name mes algo
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; typedef long long ll; ll list[200010]; ll ans[200010]; ll g[200010]; ll f[200010]; int n,c; int main(){ scanf("%d %d",&n,&c); for(int i=1;i<n;i++){ scanf("%lld",&list[i]); } for(int i=1;i<n;i++){ scanf("%lld",&ans[i]); } cout<<0<<" "; f[1] = 10000000000; for(int i=2;i<=n;i++){ g[i] = min(g[i-1] + list[i-1], f[i-1] + list[i-1]); f[i] = min(g[i-1] + ans[i-1] + c,f[i-1] + ans[i-1]); cout<<min(g[i],f[i])<<" "; } return 0; }
标签:pre div 图片 clu 技术 cstring name mes algo
原文地址:https://www.cnblogs.com/lesning/p/11728021.html