Pro1
原始文件为 CPP 代码,本文是转换后的 Markdown 文件。
#include <iostream>
#include <cstring>
#include <string>
using namespace std;
int main() {
//freopen("in.txt","r",stdin);
int n,m;
scanf("%d%d",&n,&m);
int total = 0;
int count = 0;
for (int i = 0; i < n; ++i) {
int thisweight;
scanf("%d",&thisweight);
total += thisweight;
if (total >= m) {
++count;
total = 0;
}
}
if (total > 0) ++count;
printf("%d\n",count);
}