这题有毒,我要报警

P1181 数列分段 Section I

这题太水了吧!!! ```cpp #include<iostream> #include<cstring> #include<cstdio> #include<cmath> using namespace std; int main() { int n,m,k=1,a,x=0; cin>>n>>m; for(int i=1;i<=n;i++) { cin>>a; if(x+a<=m) x+=a; else { k++; x=a; } } cout<<k; return 0; } ``` 这。。。。。 都行。。。。 真牛掰。。。 我还以为。。 要用到数组。
by lxyhhhhhh @ 2017-07-29 08:59:52


@[永忻](/space/show?uid=2220) 我感觉是你该去好好看看题目再来评论别人,别一看不懂就喷
by 帅比王2018 @ 2018-04-21 14:56:45


kg
by Rieman_sum @ 2023-07-26 16:06:19


上一页 |