提交记录 9840
提交时间 |
评测时间 |
2019-07-16 20:30:58 |
2020-08-01 01:56:00 |
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int f[26000];
int a[110];
int n,T,ans;
int main()
{
cin>>T;
while(T--)
{
memset(f,0,sizeof(f));
cin>>n;
ans=n;
for(int i=1;i<=n;i++)
{
cin>>a[i];
}
sort(a+1,a+n+1);
f[0]=1;
for(int i=1;i<=n;i++)
{
if(f[a[i]])
{
ans--;
continue;
}
for(int j=a[i];j<=a[n];j++)
{
f[j]=f[j]|f[j-a[i]];
}
}
cout<<ans<<endl;
}
return 0;
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 105.39 us | 136 KB | Accepted | Score: 5 | 显示更多 |
Testcase #2 | 103.05 us | 136 KB | Accepted | Score: 5 | 显示更多 |
Testcase #3 | 106.29 us | 136 KB | Accepted | Score: 5 | 显示更多 |
Testcase #4 | 105.18 us | 136 KB | Accepted | Score: 5 | 显示更多 |
Testcase #5 | 106.44 us | 136 KB | Accepted | Score: 5 | 显示更多 |
Testcase #6 | 110.76 us | 136 KB | Accepted | Score: 5 | 显示更多 |
Testcase #7 | 108.77 us | 136 KB | Accepted | Score: 5 | 显示更多 |
Testcase #8 | 131.12 us | 136 KB | Accepted | Score: 5 | 显示更多 |
Testcase #9 | 113.58 us | 136 KB | Accepted | Score: 5 | 显示更多 |
Testcase #10 | 118.11 us | 136 KB | Accepted | Score: 5 | 显示更多 |
Testcase #11 | 109.63 us | 136 KB | Accepted | Score: 5 | 显示更多 |
Testcase #12 | 109.89 us | 136 KB | Accepted | Score: 5 | 显示更多 |
Testcase #13 | 111.53 us | 136 KB | Accepted | Score: 5 | 显示更多 |
Testcase #14 | 142.22 us | 136 KB | Accepted | Score: 5 | 显示更多 |
Testcase #15 | 146.17 us | 136 KB | Accepted | Score: 5 | 显示更多 |
Testcase #16 | 138.96 us | 136 KB | Accepted | Score: 5 | 显示更多 |
Testcase #17 | 5.534 ms | 136 KB | Accepted | Score: 5 | 显示更多 |
Testcase #18 | 5.56 ms | 136 KB | Accepted | Score: 5 | 显示更多 |
Testcase #19 | 5.562 ms | 136 KB | Accepted | Score: 5 | 显示更多 |
Testcase #20 | 5.663 ms | 136 KB | Accepted | Score: 5 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:42:07 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠