提交记录 6970


用户 题目 状态 得分 用时 内存 语言 代码长度
Yuanxu_Wang noip18b. 【NOIP2018】货币系统 Accepted 100 21.931 ms 140 KB C++ 887 B
提交时间 评测时间
2018-11-25 10:37:49 2020-08-01 00:55:28
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>

using namespace std;

int a[101000], b[101000], n, ans = 0;int f[25050];

int readint() {
	int frog = 1, x = 0;char c = getchar();
	while(c < '0' || c > '9' ) {
		if(c == '-')
			frog = -1;
		c = getchar();
	}
	while(c >= '0' && c <= '9'){
		x = (x << 3) + (x << 1) + c - '0';
		c = getchar();
	}
	return x * frog;
}

int main() {
	int T;
	cin >> T;
	while(T--) {
	    int maxn = 0, ans = 0;
		n = readint();
		ans = n; 
		memset(f, 0, sizeof(f));
		for(int i = 1; i <= n; i++){
			a[i] = readint();
			maxn = max(maxn, a[i]);
		}
		sort(a + 1, a + 1 + n);
		f[0] = 1;
		for(int i = 1; i <= n; i++){
		    for(int j = a[i]; j <= maxn; j++)
		        if(f[j - a[i]] > 0)++f[j];
		}
		for(int i = 1; i <= n; i++)
			if(f[a[i]] > 1)ans -= 1;
		cout << ans << endl;
	}
	return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #195.64 us140 KBAcceptedScore: 5

Testcase #2108.34 us140 KBAcceptedScore: 5

Testcase #395.13 us140 KBAcceptedScore: 5

Testcase #4112.74 us140 KBAcceptedScore: 5

Testcase #5107.43 us140 KBAcceptedScore: 5

Testcase #6105.33 us140 KBAcceptedScore: 5

Testcase #7112.18 us140 KBAcceptedScore: 5

Testcase #8131.32 us140 KBAcceptedScore: 5

Testcase #9126.82 us140 KBAcceptedScore: 5

Testcase #10132.23 us140 KBAcceptedScore: 5

Testcase #1197.67 us140 KBAcceptedScore: 5

Testcase #1293.89 us140 KBAcceptedScore: 5

Testcase #1393.8 us140 KBAcceptedScore: 5

Testcase #14119.22 us140 KBAcceptedScore: 5

Testcase #15118.65 us140 KBAcceptedScore: 5

Testcase #16116.99 us140 KBAcceptedScore: 5

Testcase #1721.454 ms140 KBAcceptedScore: 5

Testcase #1821.357 ms140 KBAcceptedScore: 5

Testcase #1921.931 ms140 KBAcceptedScore: 5

Testcase #2021.41 ms140 KBAcceptedScore: 5


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