提交记录 15696


用户 题目 状态 得分 用时 内存 语言 代码长度
Mr_think noip18b. 【NOIP2018】货币系统 Accepted 100 6.609 ms 216 KB C++ 488 B
提交时间 评测时间
2021-01-25 11:54:29 2021-01-25 11:54:33
#include<cstdio> 
#include<cstring>
#include<algorithm>
using namespace std;
long long f[25001],c[10002];
int main()
{
	long long n,ans;
	int t;
	scanf("%d",&t);
	while(t--)
	{
		memset(f,0,sizeof(f));
		scanf("%lld",&n);ans=n;
		for(long long i=1;i<=n;i++)
			scanf("%lld",&c[i]);
		sort(c+1,c+n+1);
		f[0]=1;
		for(int i=1;i<=n;i++)
		{
			if(f[c[i]])
			{
				ans--;
				continue;
			}
			for(int j=c[i];j<=c[n];j++)
				f[j]|=f[j-c[i]];
			
		}
		printf("%lld\n",ans);
	}
	return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1112.59 us216 KBAcceptedScore: 5

Testcase #2118.28 us216 KBAcceptedScore: 5

Testcase #3116.94 us216 KBAcceptedScore: 5

Testcase #4117.59 us216 KBAcceptedScore: 5

Testcase #5117.81 us216 KBAcceptedScore: 5

Testcase #6117.74 us216 KBAcceptedScore: 5

Testcase #7120.48 us216 KBAcceptedScore: 5

Testcase #8117.74 us216 KBAcceptedScore: 5

Testcase #9125.44 us216 KBAcceptedScore: 5

Testcase #10127.29 us216 KBAcceptedScore: 5

Testcase #11121.09 us216 KBAcceptedScore: 5

Testcase #12119.56 us216 KBAcceptedScore: 5

Testcase #13122.73 us216 KBAcceptedScore: 5

Testcase #14142.39 us216 KBAcceptedScore: 5

Testcase #15127.95 us216 KBAcceptedScore: 5

Testcase #16139.19 us216 KBAcceptedScore: 5

Testcase #176.461 ms216 KBAcceptedScore: 5

Testcase #186.494 ms216 KBAcceptedScore: 5

Testcase #196.467 ms216 KBAcceptedScore: 5

Testcase #206.609 ms216 KBAcceptedScore: 5


Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:16:17 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠