You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
411 B

#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
int count = 0;
int sum = 0;
for (int i = 1; i <= n; i++) {
int ai;
cin >> ai;
sum += ai;
if (sum >= k) {
sum = 0;
count++;
}
}
//打补丁
if (sum > 0) count++;
cout << count << endl;
return 0;
}