提交记录 8432


用户 题目 状态 得分 用时 内存 语言 代码长度
AThousandMoon noip18b. 【NOIP2018】货币系统 Accepted 100 8.439 ms 40 KB C++ 509 B
提交时间 评测时间
2019-02-16 22:23:02 2020-08-01 01:18:44
#include<cstdio>
#include<algorithm>
#include<cstring>
#define Rint register int
using namespace std;
const int N = 103, M = 25003;
int t, n, ans, a[N];
bool f[M];
int main(){
	scanf("%d", &t);
	while(t --){
		memset(f, 0, sizeof f); ans = 0;
		scanf("%d", &n);
		for(Rint i = 1;i <= n;i ++)
			scanf("%d", a + i);
		sort(a + 1, a + n + 1);
		f[0] = 1;
		for(Rint i = 1;i <= n;i ++)
			if(!f[a[i]]){
				++ ans;
				for(Rint j = a[i];j <= 25000;j ++)
					f[j] |= f[j - a[i]];
			}
		printf("%d\n", ans);
	}
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1384.67 us40 KBAcceptedScore: 5

Testcase #2369.75 us40 KBAcceptedScore: 5

Testcase #3367.74 us40 KBAcceptedScore: 5

Testcase #4553.93 us40 KBAcceptedScore: 5

Testcase #5494.89 us40 KBAcceptedScore: 5

Testcase #6478.61 us40 KBAcceptedScore: 5

Testcase #7631.82 us40 KBAcceptedScore: 5

Testcase #8643.66 us40 KBAcceptedScore: 5

Testcase #9754.1 us40 KBAcceptedScore: 5

Testcase #10760.46 us40 KBAcceptedScore: 5

Testcase #11986.31 us40 KBAcceptedScore: 5

Testcase #121.015 ms40 KBAcceptedScore: 5

Testcase #13974.75 us40 KBAcceptedScore: 5

Testcase #141.363 ms40 KBAcceptedScore: 5

Testcase #151.491 ms40 KBAcceptedScore: 5

Testcase #161.311 ms40 KBAcceptedScore: 5

Testcase #178.12 ms40 KBAcceptedScore: 5

Testcase #188.273 ms40 KBAcceptedScore: 5

Testcase #198.151 ms40 KBAcceptedScore: 5

Testcase #208.439 ms40 KBAcceptedScore: 5


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