#include"bits/stdc++.h"
using namespace std;
const int N = 3e4+5;
int s[N],n,m;
int main()
{
cin >> n >> m;
for(int i=1; i<=m;i++) cin >> s[i];
sort(s+1,s+1+m);
int ans = 0;
int l=1 , r=m;
while(l<=r)
{
if(s[l]+s[r] > n){
r--;
}else{
l++;
r--;
}
ans++;
}
cout << ans << endl;
return 0;
}
P1094 [NOIP2007 普及组] 纪念品分组(双指针)
猜你喜欢
转载自blog.csdn.net/weixin_53013914/article/details/120619833
今日推荐
周排行