201703-1 分蛋糕 题目 思路 略 AC代码如下 //13:40 #include<cstdio> int main(){ int n,k,ans=0,t,now=0; scanf("%d%d",&n,&k); while(n--){ scanf("%d",&t); if(now+t>=k) { ans++; now=0; } else now+=t; } if(now>0) ans++; printf("%d",ans); return 0; }