http://www.luogu.org/problem/show?pid=1181
水题不解释
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#define ms(i,j) memset(i,j, sizeof i);
using namespace std;
int main()
{
int n,m;
int ans = 1;
int tot = 0;
scanf("%d%d", &n, &m);
for (int i=1;i<=n;i++)
{
int a;
scanf("%d", &a);
if (tot+a<=m) tot += a;
else {ans++; tot = a;}
}
printf("%d\n", ans);
return 0;
}