提交记录 6984
| 提交时间 |
评测时间 |
| 2018-12-02 08:34:21 |
2020-08-01 00:56:24 |
#include<iostream>
#include<cstdio>
#include<cstring>
int t,a[1010],n;
int read();
void write(int);
bool dfs(int,int);
int main()
{
t=read();
for(int i=1;i<=t;i++)
{
n=read();
memset(a,0,sizeof(a));
int ans=n;
for(int j=1;j<=n;j++)
a[j]=read();
for(int j=1;j<=n;j++)
{
if(dfs(a[j],j)) ans--;
}
write(ans);putchar('\n');
//printf("%d\n",ans);
}
return 0;
}
int read()
{
int _=0,___=1;char __=getchar();
while(__<'0'||__>'9')
{
if(__=='-') ___=-1;
__=getchar();
}
while(__>='0'&&__<='9')
{
_=_*10+__-'0';
__=getchar();
}
return _*___;
}
void write(int Num)
{
if(Num<0) putchar('-'),Num*=-1;
if(Num>=10) write(Num/10);
putchar(Num%10+'0');
}
bool dfs(int ask,int node)
{
bool ok=0;
if(ask==0)
ok=1;
for(int i=1;i<=n&&!ok;i++)
if(a[i]<=ask&&i!=node) ok= ok ||dfs(ask-a[i],node);
return ok;
}
| Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
| Testcase #1 | 37.67 us | 40 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #2 | 38.54 us | 44 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #3 | 37.32 us | 40 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #4 | 62.64 us | 44 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #5 | 47.24 us | 48 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #6 | 57.51 us | 44 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #7 | 53.22 us | 52 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #8 | 70.96 us | 40 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #9 | 137.59 us | 44 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #10 | 179.68 us | 44 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #11 | 55.85 us | 40 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #12 | 50.72 us | 40 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #13 | 53.86 us | 40 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #14 | 104.32 us | 40 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #15 | 120.2 us | 40 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #16 | 105.62 us | 40 KB | Accepted | Score: 5 | 显示更多 |
| Testcase #17 | 1 s | 40 KB | Time Limit Exceeded | Score: 0 | 显示更多 |
| Testcase #18 | 1 s | 40 KB | Time Limit Exceeded | Score: 0 | 显示更多 |
| Testcase #19 | 1 s | 36 KB | Time Limit Exceeded | Score: 0 | 显示更多 |
| Testcase #20 | 1 s | 36 KB | Time Limit Exceeded | Score: 0 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2026-04-09 04:57:28 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠