mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-05 13:18:47 +00:00
20 lines
330 B
C++
20 lines
330 B
C++
#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;
|
|
}
|