#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 0x3f3f3f3f
int main(){
int w;
cin>>w;
int n,num[30009]={
},sum=0;
cin>>n;
for(int i=0;i<n;i++){
cin>>num[i];
}sort(num,num+n);
int l=0,r=n-1;
while(l<=r){
//?
if(num[l]+num[r]<=w)l++,r--,sum++;
else {
r--,sum++;
}
}
cout<<sum;
return 0;
}
luogu P1094 [NOIP2007 普及组] 纪念品分组
猜你喜欢
转载自blog.csdn.net/Minelois/article/details/113956874
今日推荐
周排行