提交记录 6970
提交时间 |
评测时间 |
2018-11-25 10:37:49 |
2020-08-01 00:55:28 |
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int a[101000], b[101000], n, ans = 0;int f[25050];
int readint() {
int frog = 1, x = 0;char c = getchar();
while(c < '0' || c > '9' ) {
if(c == '-')
frog = -1;
c = getchar();
}
while(c >= '0' && c <= '9'){
x = (x << 3) + (x << 1) + c - '0';
c = getchar();
}
return x * frog;
}
int main() {
int T;
cin >> T;
while(T--) {
int maxn = 0, ans = 0;
n = readint();
ans = n;
memset(f, 0, sizeof(f));
for(int i = 1; i <= n; i++){
a[i] = readint();
maxn = max(maxn, a[i]);
}
sort(a + 1, a + 1 + n);
f[0] = 1;
for(int i = 1; i <= n; i++){
for(int j = a[i]; j <= maxn; j++)
if(f[j - a[i]] > 0)++f[j];
}
for(int i = 1; i <= n; i++)
if(f[a[i]] > 1)ans -= 1;
cout << ans << endl;
}
return 0;
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 95.64 us | 140 KB | Accepted | Score: 5 | 显示更多 |
Testcase #2 | 108.34 us | 140 KB | Accepted | Score: 5 | 显示更多 |
Testcase #3 | 95.13 us | 140 KB | Accepted | Score: 5 | 显示更多 |
Testcase #4 | 112.74 us | 140 KB | Accepted | Score: 5 | 显示更多 |
Testcase #5 | 107.43 us | 140 KB | Accepted | Score: 5 | 显示更多 |
Testcase #6 | 105.33 us | 140 KB | Accepted | Score: 5 | 显示更多 |
Testcase #7 | 112.18 us | 140 KB | Accepted | Score: 5 | 显示更多 |
Testcase #8 | 131.32 us | 140 KB | Accepted | Score: 5 | 显示更多 |
Testcase #9 | 126.82 us | 140 KB | Accepted | Score: 5 | 显示更多 |
Testcase #10 | 132.23 us | 140 KB | Accepted | Score: 5 | 显示更多 |
Testcase #11 | 97.67 us | 140 KB | Accepted | Score: 5 | 显示更多 |
Testcase #12 | 93.89 us | 140 KB | Accepted | Score: 5 | 显示更多 |
Testcase #13 | 93.8 us | 140 KB | Accepted | Score: 5 | 显示更多 |
Testcase #14 | 119.22 us | 140 KB | Accepted | Score: 5 | 显示更多 |
Testcase #15 | 118.65 us | 140 KB | Accepted | Score: 5 | 显示更多 |
Testcase #16 | 116.99 us | 140 KB | Accepted | Score: 5 | 显示更多 |
Testcase #17 | 21.454 ms | 140 KB | Accepted | Score: 5 | 显示更多 |
Testcase #18 | 21.357 ms | 140 KB | Accepted | Score: 5 | 显示更多 |
Testcase #19 | 21.931 ms | 140 KB | Accepted | Score: 5 | 显示更多 |
Testcase #20 | 21.41 ms | 140 KB | Accepted | Score: 5 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:39:26 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠