12 条题解
-
1
#include <bits/stdc++.h> using namespace std; int main(){ int s,i; scanf("%d",&s); while(s--){ int w,n,temp,a[300]; scanf("%d%d",&w,&n); temp=n-1; for(i=0;i<n;i++){ scanf("%d",&a[i]); } sort(a,a+n); for(i=0;temp>i;){ if(a[i]+a[temp]<=w){n--;i++;temp--;} else temp--; } printf("%d\n",n); } }
信息
- ID
- 148
- 时间
- 3000ms
- 内存
- 128MiB
- 难度
- 6
- 标签
- (无)
- 递交数
- 592
- 已通过
- 199
- 上传者