8 条题解
-
1
#include<stdio.h> #include<string.h> int vis[205]; int main() { int t; scanf("%d", &t); while (t --) { int k, n; int sum = 0; scanf("%d %d", &k, &n); int a[n + 1]; vis[0] = 1; for (int i = 1; i <= n; i ++) { scanf("%d", &a[i]); vis[a[i]] ++; } int max = 200; while (vis[max] == 0) max --; while (max) { vis[max] --; sum ++; int c = k - max; while (vis[c] == 0) c --; if (c) vis[c] --; while (vis[max] == 0) max --; } printf("%d\n", sum); memset(vis, 0, sizeof(vis)); } return 0; }
信息
- ID
- 148
- 时间
- 3000ms
- 内存
- 128MiB
- 难度
- 6
- 标签
- (无)
- 递交数
- 524
- 已通过
- 174
- 上传者