提交记录 9840


用户 题目 状态 得分 用时 内存 语言 代码长度
Lagerstroemia noip18b. 【NOIP2018】货币系统 Accepted 100 5.663 ms 136 KB C++ 526 B
提交时间 评测时间
2019-07-16 20:30:58 2020-08-01 01:56:00
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int f[26000];
int a[110];
int n,T,ans;
int main()
{
	cin>>T;
	while(T--)
   {
   	  memset(f,0,sizeof(f));
   	  cin>>n;
   	  ans=n;
   	  for(int i=1;i<=n;i++)
   	  {
   	  	cin>>a[i];
		 }
		 sort(a+1,a+n+1);
		 f[0]=1;
		 for(int i=1;i<=n;i++)
		 {
		 	if(f[a[i]]) 
		 	{
		 		ans--;
		 		continue;
			 }
			 for(int j=a[i];j<=a[n];j++)
			 {
			 	f[j]=f[j]|f[j-a[i]];
			 }
			 }
			 cout<<ans<<endl;
			 }
			 return 0;
		 }

CompilationN/AN/ACompile OKScore: N/A

Testcase #1105.39 us136 KBAcceptedScore: 5

Testcase #2103.05 us136 KBAcceptedScore: 5

Testcase #3106.29 us136 KBAcceptedScore: 5

Testcase #4105.18 us136 KBAcceptedScore: 5

Testcase #5106.44 us136 KBAcceptedScore: 5

Testcase #6110.76 us136 KBAcceptedScore: 5

Testcase #7108.77 us136 KBAcceptedScore: 5

Testcase #8131.12 us136 KBAcceptedScore: 5

Testcase #9113.58 us136 KBAcceptedScore: 5

Testcase #10118.11 us136 KBAcceptedScore: 5

Testcase #11109.63 us136 KBAcceptedScore: 5

Testcase #12109.89 us136 KBAcceptedScore: 5

Testcase #13111.53 us136 KBAcceptedScore: 5

Testcase #14142.22 us136 KBAcceptedScore: 5

Testcase #15146.17 us136 KBAcceptedScore: 5

Testcase #16138.96 us136 KBAcceptedScore: 5

Testcase #175.534 ms136 KBAcceptedScore: 5

Testcase #185.56 ms136 KBAcceptedScore: 5

Testcase #195.562 ms136 KBAcceptedScore: 5

Testcase #205.663 ms136 KBAcceptedScore: 5


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