提交时间:2020-10-31 18:57:15

运行 ID: 8247

#include<bits/stdc++.h> using namespace std; int main(){ int m,n,sum=0; cin>>m>>n; int a[n+1]; for(int i=1;i<=n;i++){ cin>>a[i]; if(a[i]>m) sum++; else m-=a[i]; } cout<<sum; return 0; }