提交记录 9587
提交时间 |
评测时间 |
2019-06-13 17:33:28 |
2020-08-01 01:41:04 |
#include <cstdio>
#include <cstring>
#include <algorithm>
const int N=105;
int n,a[N];
bool f[25005];
int main() {
int T;
for(scanf("%d",&T);T--;) {
scanf("%d",&n);
int mx=0;
for(int i=1;i<=n;++i) scanf("%d",&a[i]),mx=mx>a[i]?mx:a[i];
std::sort(a+1,a+n+1);
memset(f,0,sizeof(f));
f[0]=1;
int ans=0;
for(int i=1;i<=n;++i) {
if(!f[a[i]]) {
++ans;
for(int j=a[i];j<=mx;++j) f[j]|=f[j-a[i]];
}
}
printf("%d\n",ans);
}
return 0;
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 29.17 us | 40 KB | Accepted | Score: 5 | 显示更多 |
Testcase #2 | 33.88 us | 40 KB | Accepted | Score: 5 | 显示更多 |
Testcase #3 | 43.05 us | 40 KB | Accepted | Score: 5 | 显示更多 |
Testcase #4 | 35.89 us | 40 KB | Accepted | Score: 5 | 显示更多 |
Testcase #5 | 34.01 us | 40 KB | Accepted | Score: 5 | 显示更多 |
Testcase #6 | 34.26 us | 40 KB | Accepted | Score: 5 | 显示更多 |
Testcase #7 | 36.28 us | 40 KB | Accepted | Score: 5 | 显示更多 |
Testcase #8 | 37.04 us | 40 KB | Accepted | Score: 5 | 显示更多 |
Testcase #9 | 45.8 us | 40 KB | Accepted | Score: 5 | 显示更多 |
Testcase #10 | 47.39 us | 40 KB | Accepted | Score: 5 | 显示更多 |
Testcase #11 | 36.27 us | 40 KB | Accepted | Score: 5 | 显示更多 |
Testcase #12 | 33.91 us | 40 KB | Accepted | Score: 5 | 显示更多 |
Testcase #13 | 34.44 us | 40 KB | Accepted | Score: 5 | 显示更多 |
Testcase #14 | 55.72 us | 40 KB | Accepted | Score: 5 | 显示更多 |
Testcase #15 | 59.62 us | 40 KB | Accepted | Score: 5 | 显示更多 |
Testcase #16 | 51.28 us | 40 KB | Accepted | Score: 5 | 显示更多 |
Testcase #17 | 7.896 ms | 40 KB | Accepted | Score: 5 | 显示更多 |
Testcase #18 | 7.933 ms | 40 KB | Accepted | Score: 5 | 显示更多 |
Testcase #19 | 7.918 ms | 40 KB | Accepted | Score: 5 | 显示更多 |
Testcase #20 | 8.079 ms | 40 KB | Accepted | Score: 5 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:29:54 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠