import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt(),k = sc.nextInt();
int boy = 0;
int sum = 0;
for(int i = 1;i <=n;i++){
int cake = sc.nextInt();
if(sum<k){
sum+=cake;
}
if(sum>=k){
sum=0;
boy++;
}
}
if(sum!=0){
boy = boy +1;
}
System.out.println(boy);
}
}
ccf 分蛋糕
最新推荐文章于 2023-01-29 15:11:29 发布