0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2025-01-26 05:20:18 +00:00

21 lines
338 B
C++
Raw Normal View History

2020-10-16 21:23:45 +08:00
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, sum = 0, ans = 1, t;
cin >> n >> m;
for (int i = 0; i < n; i++) {
cin >> t;
if (sum + t > m) {
ans++;
sum = t;
}
else {
sum += t;
}
}
cout << ans << endl;
return 0;
}