提交记录 17664
提交时间 |
评测时间 |
2022-04-16 10:32:24 |
2022-04-16 10:32:45 |
#include<bits/stdc++.h>
using namespace std;
int T;
int dp[50011];
int c[10021];
int n;
int main()
{
cin>>T;
while(T--){
int maxx=0;
cin>>n;
memset(dp,-0x3f3f3f,sizeof dp);
dp[0]=0;
memset(c,0,sizeof c);
for(int i=1;i<=n;i++){
cin>>c[i];
dp[c[i]]=1;
maxx=max(maxx,c[i]);
}
for(int i=1;i<=n;i++){
for(int j=c[i];j<=30000;j++){
dp[j]=max(dp[j],dp[j-c[i]]+1);
}
}
int ans=0;
for(int i=1;i<=n;i++){
if(dp[c[i]]==1){
ans++;
}
}
cout<<ans<<endl;
}
return 0;
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 801.06 us | 272 KB | Accepted | Score: 5 | 显示更多 |
Testcase #2 | 811.54 us | 272 KB | Accepted | Score: 5 | 显示更多 |
Testcase #3 | 810.83 us | 272 KB | Accepted | Score: 5 | 显示更多 |
Testcase #4 | 1.138 ms | 272 KB | Accepted | Score: 5 | 显示更多 |
Testcase #5 | 1.136 ms | 272 KB | Accepted | Score: 5 | 显示更多 |
Testcase #6 | 1.13 ms | 272 KB | Accepted | Score: 5 | 显示更多 |
Testcase #7 | 1.506 ms | 272 KB | Accepted | Score: 5 | 显示更多 |
Testcase #8 | 1.467 ms | 272 KB | Accepted | Score: 5 | 显示更多 |
Testcase #9 | 1.797 ms | 272 KB | Accepted | Score: 5 | 显示更多 |
Testcase #10 | 1.792 ms | 272 KB | Accepted | Score: 5 | 显示更多 |
Testcase #11 | 3.307 ms | 272 KB | Accepted | Score: 5 | 显示更多 |
Testcase #12 | 3.394 ms | 272 KB | Accepted | Score: 5 | 显示更多 |
Testcase #13 | 3.045 ms | 272 KB | Accepted | Score: 5 | 显示更多 |
Testcase #14 | 6.844 ms | 272 KB | Accepted | Score: 5 | 显示更多 |
Testcase #15 | 6.664 ms | 272 KB | Accepted | Score: 5 | 显示更多 |
Testcase #16 | 7.121 ms | 272 KB | Accepted | Score: 5 | 显示更多 |
Testcase #17 | 20.648 ms | 272 KB | Accepted | Score: 5 | 显示更多 |
Testcase #18 | 20.704 ms | 272 KB | Accepted | Score: 5 | 显示更多 |
Testcase #19 | 20.89 ms | 272 KB | Accepted | Score: 5 | 显示更多 |
Testcase #20 | 20.768 ms | 272 KB | Accepted | Score: 5 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:17:07 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠