提交记录 15696
提交时间 |
评测时间 |
2021-01-25 11:54:29 |
2021-01-25 11:54:33 |
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
long long f[25001],c[10002];
int main()
{
long long n,ans;
int t;
scanf("%d",&t);
while(t--)
{
memset(f,0,sizeof(f));
scanf("%lld",&n);ans=n;
for(long long i=1;i<=n;i++)
scanf("%lld",&c[i]);
sort(c+1,c+n+1);
f[0]=1;
for(int i=1;i<=n;i++)
{
if(f[c[i]])
{
ans--;
continue;
}
for(int j=c[i];j<=c[n];j++)
f[j]|=f[j-c[i]];
}
printf("%lld\n",ans);
}
return 0;
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 112.59 us | 216 KB | Accepted | Score: 5 | 显示更多 |
Testcase #2 | 118.28 us | 216 KB | Accepted | Score: 5 | 显示更多 |
Testcase #3 | 116.94 us | 216 KB | Accepted | Score: 5 | 显示更多 |
Testcase #4 | 117.59 us | 216 KB | Accepted | Score: 5 | 显示更多 |
Testcase #5 | 117.81 us | 216 KB | Accepted | Score: 5 | 显示更多 |
Testcase #6 | 117.74 us | 216 KB | Accepted | Score: 5 | 显示更多 |
Testcase #7 | 120.48 us | 216 KB | Accepted | Score: 5 | 显示更多 |
Testcase #8 | 117.74 us | 216 KB | Accepted | Score: 5 | 显示更多 |
Testcase #9 | 125.44 us | 216 KB | Accepted | Score: 5 | 显示更多 |
Testcase #10 | 127.29 us | 216 KB | Accepted | Score: 5 | 显示更多 |
Testcase #11 | 121.09 us | 216 KB | Accepted | Score: 5 | 显示更多 |
Testcase #12 | 119.56 us | 216 KB | Accepted | Score: 5 | 显示更多 |
Testcase #13 | 122.73 us | 216 KB | Accepted | Score: 5 | 显示更多 |
Testcase #14 | 142.39 us | 216 KB | Accepted | Score: 5 | 显示更多 |
Testcase #15 | 127.95 us | 216 KB | Accepted | Score: 5 | 显示更多 |
Testcase #16 | 139.19 us | 216 KB | Accepted | Score: 5 | 显示更多 |
Testcase #17 | 6.461 ms | 216 KB | Accepted | Score: 5 | 显示更多 |
Testcase #18 | 6.494 ms | 216 KB | Accepted | Score: 5 | 显示更多 |
Testcase #19 | 6.467 ms | 216 KB | Accepted | Score: 5 | 显示更多 |
Testcase #20 | 6.609 ms | 216 KB | Accepted | Score: 5 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:16:17 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠