30求条必关
查看原帖
30求条必关
664531
oldsix_2楼主2025/7/31 09:36
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m,k=0,ans=0;
	cin>>m>>n;
	while(n--){
		int a; cin>>a;
		if(k+a<=m){
			k+=a;
		}else{
			ans++;
			k=a;
		}
	}
	cout<<ans;
	return 0;
}/*
  _____
 /_____ \       _          _
| |   |_|      | |        | |
| |          __| |__    __| |__
| |         |__   __|  |__   __|
| |    _       | |        | |
| |___/ |      |_|        |_|
 \_____/
 */

我不会给你评测记录的

2025/7/31 09:36
加载中...