救民于水火

caochenshuo 2023-11-25 18:49:29 8 返回题目

#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,m,a[100001],t,s=1;
signed main(){
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        t+=a[i];
        if(t>m)t=a[i],s++;
    }
    cout<<s;
    return 0;
}
{{ vote && vote.total.up }}