提交记录 6959
提交时间 |
评测时间 |
2018-11-24 14:11:33 |
2020-08-01 00:55:16 |
#include<bits/stdc++.h>
using namespace std;
inline int getint(){
int ans=0,f=1;
char c=getchar();
while(c>'9'||c<'0'){
//if(c=='-')f=-1;
c=getchar();
}
while(c>='0'&&c<='9'){
ans=ans*10+c-'0';
c=getchar();
}
return ans;
}
const int M=25010,N=110;
int f[M],a[N];
int main(){
int t=getint(),n,mx=0;
while(t--){
n=getint();
for(register int i=0;i<n;++i)mx=max(a[i]=getint(),mx);
sort(a,a+n);
memset(f,0,sizeof(f));
f[0]=1;
int ans=n;
for(register int i=0;i<n;++i){
if(f[a[i]]){
--ans;
continue;
}
for(register int j=a[i];j<=mx;j++)if(f[j-a[i]])f[j]=1;
}
printf("%d\n",ans);
}
return 0;
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 105.11 us | 132 KB | Accepted | Score: 5 | 显示更多 |
Testcase #2 | 108.89 us | 132 KB | Accepted | Score: 5 | 显示更多 |
Testcase #3 | 111.07 us | 132 KB | Accepted | Score: 5 | 显示更多 |
Testcase #4 | 129.25 us | 132 KB | Accepted | Score: 5 | 显示更多 |
Testcase #5 | 115.51 us | 132 KB | Accepted | Score: 5 | 显示更多 |
Testcase #6 | 107.64 us | 132 KB | Accepted | Score: 5 | 显示更多 |
Testcase #7 | 117.72 us | 132 KB | Accepted | Score: 5 | 显示更多 |
Testcase #8 | 117.96 us | 132 KB | Accepted | Score: 5 | 显示更多 |
Testcase #9 | 128.17 us | 132 KB | Accepted | Score: 5 | 显示更多 |
Testcase #10 | 133.77 us | 132 KB | Accepted | Score: 5 | 显示更多 |
Testcase #11 | 94.24 us | 132 KB | Accepted | Score: 5 | 显示更多 |
Testcase #12 | 93.7 us | 132 KB | Accepted | Score: 5 | 显示更多 |
Testcase #13 | 95.38 us | 132 KB | Accepted | Score: 5 | 显示更多 |
Testcase #14 | 104.05 us | 132 KB | Accepted | Score: 5 | 显示更多 |
Testcase #15 | 106.7 us | 132 KB | Accepted | Score: 5 | 显示更多 |
Testcase #16 | 106.91 us | 132 KB | Accepted | Score: 5 | 显示更多 |
Testcase #17 | 19.51 ms | 132 KB | Accepted | Score: 5 | 显示更多 |
Testcase #18 | 19.037 ms | 132 KB | Accepted | Score: 5 | 显示更多 |
Testcase #19 | 19.425 ms | 132 KB | Accepted | Score: 5 | 显示更多 |
Testcase #20 | 19.747 ms | 132 KB | Accepted | Score: 5 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:39:19 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠