提交记录 6961
提交时间 |
评测时间 |
2018-11-24 18:02:56 |
2020-08-01 00:55:19 |
#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
int T, n, a[233];
bool ex[50005];
int main() {
scanf("%d", &T);
while (T--) {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", a + i);
memset(ex, 0, sizeof ex);
ex[0] = 1;
sort(a + 1, a + n + 1);
int mx = 0, ans = 0;
for (int i = 1; i <= n; i++)
mx = max(mx, a[i]);
for (int i = 1; i <= n; i++) {
if (ex[a[i]]) continue;
for (int j = a[i]; j <= mx; j++)
ex[j] |= ex[j - a[i]];
ans++;
}
printf("%d\n", ans);
}
return 0;
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 44.26 us | 64 KB | Accepted | Score: 5 | 显示更多 |
Testcase #2 | 49.18 us | 64 KB | Accepted | Score: 5 | 显示更多 |
Testcase #3 | 49.59 us | 64 KB | Accepted | Score: 5 | 显示更多 |
Testcase #4 | 44.71 us | 64 KB | Accepted | Score: 5 | 显示更多 |
Testcase #5 | 48.56 us | 64 KB | Accepted | Score: 5 | 显示更多 |
Testcase #6 | 48.37 us | 64 KB | Accepted | Score: 5 | 显示更多 |
Testcase #7 | 49.82 us | 64 KB | Accepted | Score: 5 | 显示更多 |
Testcase #8 | 49.1 us | 64 KB | Accepted | Score: 5 | 显示更多 |
Testcase #9 | 54.97 us | 64 KB | Accepted | Score: 5 | 显示更多 |
Testcase #10 | 57.99 us | 64 KB | Accepted | Score: 5 | 显示更多 |
Testcase #11 | 53.4 us | 64 KB | Accepted | Score: 5 | 显示更多 |
Testcase #12 | 52.27 us | 64 KB | Accepted | Score: 5 | 显示更多 |
Testcase #13 | 51.23 us | 64 KB | Accepted | Score: 5 | 显示更多 |
Testcase #14 | 73.78 us | 64 KB | Accepted | Score: 5 | 显示更多 |
Testcase #15 | 68.96 us | 64 KB | Accepted | Score: 5 | 显示更多 |
Testcase #16 | 69.48 us | 64 KB | Accepted | Score: 5 | 显示更多 |
Testcase #17 | 6.024 ms | 64 KB | Accepted | Score: 5 | 显示更多 |
Testcase #18 | 6.058 ms | 64 KB | Accepted | Score: 5 | 显示更多 |
Testcase #19 | 6.04 ms | 64 KB | Accepted | Score: 5 | 显示更多 |
Testcase #20 | 6.169 ms | 64 KB | Accepted | Score: 5 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:07:55 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠