提交记录 9629
提交时间 |
评测时间 |
2019-06-20 22:24:10 |
2020-08-01 01:41:48 |
#include<algorithm>
#include<cstring>
#include<cstdio>
using namespace std;
int T,n,mx,sl,fh,ans,a[110],dp[25010];
int rd()
{
sl=0;fh=1;
char ch=getchar();
while(ch<'0'||'9'<ch) {if(ch=='-') fh=-1; ch=getchar();}
while('0'<=ch&&ch<='9') sl=sl*10+ch-'0',ch=getchar();
return sl*fh;
}
void upd(int x) {for(int i=x;i<=mx;++i) dp[i]|=dp[i-x];}
int main()
{
T=rd();
while(T--)
{
n=rd();mx=0;ans=0;memset(dp,0,sizeof(dp));
for(int i=1;i<=n;++i) a[i]=rd(),mx=max(mx,a[i]);
sort(a+1,a+n+1);dp[0]=1;
for(int i=1;i<=n;++i)
{
if(dp[a[i]]) continue;
ans++;upd(a[i]);
}
printf("%d\n",ans);
}
return 0;
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 60.65 us | 112 KB | Accepted | Score: 5 | 显示更多 |
Testcase #2 | 62.93 us | 112 KB | Accepted | Score: 5 | 显示更多 |
Testcase #3 | 63.16 us | 112 KB | Accepted | Score: 5 | 显示更多 |
Testcase #4 | 66.69 us | 112 KB | Accepted | Score: 5 | 显示更多 |
Testcase #5 | 65.81 us | 112 KB | Accepted | Score: 5 | 显示更多 |
Testcase #6 | 66.25 us | 112 KB | Accepted | Score: 5 | 显示更多 |
Testcase #7 | 68.12 us | 112 KB | Accepted | Score: 5 | 显示更多 |
Testcase #8 | 95.36 us | 112 KB | Accepted | Score: 5 | 显示更多 |
Testcase #9 | 71.46 us | 112 KB | Accepted | Score: 5 | 显示更多 |
Testcase #10 | 72.41 us | 112 KB | Accepted | Score: 5 | 显示更多 |
Testcase #11 | 66.12 us | 112 KB | Accepted | Score: 5 | 显示更多 |
Testcase #12 | 66.13 us | 112 KB | Accepted | Score: 5 | 显示更多 |
Testcase #13 | 65.08 us | 112 KB | Accepted | Score: 5 | 显示更多 |
Testcase #14 | 74.53 us | 112 KB | Accepted | Score: 5 | 显示更多 |
Testcase #15 | 72.48 us | 112 KB | Accepted | Score: 5 | 显示更多 |
Testcase #16 | 73.06 us | 112 KB | Accepted | Score: 5 | 显示更多 |
Testcase #17 | 5.263 ms | 112 KB | Accepted | Score: 5 | 显示更多 |
Testcase #18 | 5.301 ms | 112 KB | Accepted | Score: 5 | 显示更多 |
Testcase #19 | 5.298 ms | 112 KB | Accepted | Score: 5 | 显示更多 |
Testcase #20 | 5.402 ms | 112 KB | Accepted | Score: 5 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:32:34 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠