提交记录 17664


用户 题目 状态 得分 用时 内存 语言 代码长度
Robert123456 noip18b. 【NOIP2018】货币系统 Accepted 100 20.89 ms 272 KB C++ 516 B
提交时间 评测时间
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;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1801.06 us272 KBAcceptedScore: 5

Testcase #2811.54 us272 KBAcceptedScore: 5

Testcase #3810.83 us272 KBAcceptedScore: 5

Testcase #41.138 ms272 KBAcceptedScore: 5

Testcase #51.136 ms272 KBAcceptedScore: 5

Testcase #61.13 ms272 KBAcceptedScore: 5

Testcase #71.506 ms272 KBAcceptedScore: 5

Testcase #81.467 ms272 KBAcceptedScore: 5

Testcase #91.797 ms272 KBAcceptedScore: 5

Testcase #101.792 ms272 KBAcceptedScore: 5

Testcase #113.307 ms272 KBAcceptedScore: 5

Testcase #123.394 ms272 KBAcceptedScore: 5

Testcase #133.045 ms272 KBAcceptedScore: 5

Testcase #146.844 ms272 KBAcceptedScore: 5

Testcase #156.664 ms272 KBAcceptedScore: 5

Testcase #167.121 ms272 KBAcceptedScore: 5

Testcase #1720.648 ms272 KBAcceptedScore: 5

Testcase #1820.704 ms272 KBAcceptedScore: 5

Testcase #1920.89 ms272 KBAcceptedScore: 5

Testcase #2020.768 ms272 KBAcceptedScore: 5


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