提交记录 15038


用户 题目 状态 得分 用时 内存 语言 代码长度
suiqingying noip18b. 【NOIP2018】货币系统 Accepted 100 1.429 ms 44 KB C++ 709 B
提交时间 评测时间
2020-11-18 19:15:22 2020-11-18 19:15:26
#include <iostream>
#include <bitset>
#include <cstring>
#include <cstdio>
#include <algorithm>
int read()
{
	int x = 0;
	char c = getchar();
	while(!isdigit(c))
	{
		c = getchar();
	}
	while(isdigit(c))
	{
		x = x * 10 + c - 48;
		c = getchar();
	}
	return x;
}
const int maxn = 25000;
int a[110];
std::bitset<maxn + 10>f;
int main()
{
	int T = read();
	while(T--)
	{
		f.reset();
		f[0] = 1;
		int n = read(), ans = 0;
		for (int i = 1; i <= n; ++i)
		{
			a[i] = read();
		}
		std::sort(a + 1, a + n + 1);
		for (int i = 1; i <= n; ++i)
		{
			if(f[a[i]])
			{
				++ans;
				continue;
			}
			for (int j = a[i]; j <= a[n]; j <<= 1)
			{
				f |= f << j;
			}
		}
		printf("%d\n", n - ans);
	}
	return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #181.72 us44 KBAcceptedScore: 5

Testcase #289.34 us44 KBAcceptedScore: 5

Testcase #3137.61 us44 KBAcceptedScore: 5

Testcase #4156.74 us44 KBAcceptedScore: 5

Testcase #5153.3 us44 KBAcceptedScore: 5

Testcase #6150.45 us44 KBAcceptedScore: 5

Testcase #7119.22 us44 KBAcceptedScore: 5

Testcase #8163.23 us44 KBAcceptedScore: 5

Testcase #9134.74 us44 KBAcceptedScore: 5

Testcase #10151.41 us44 KBAcceptedScore: 5

Testcase #11141.17 us44 KBAcceptedScore: 5

Testcase #12132.49 us44 KBAcceptedScore: 5

Testcase #13130.31 us44 KBAcceptedScore: 5

Testcase #14231.5 us44 KBAcceptedScore: 5

Testcase #15241.1 us44 KBAcceptedScore: 5

Testcase #16198.42 us44 KBAcceptedScore: 5

Testcase #171.368 ms44 KBAcceptedScore: 5

Testcase #181.402 ms44 KBAcceptedScore: 5

Testcase #191.406 ms44 KBAcceptedScore: 5

Testcase #201.429 ms44 KBAcceptedScore: 5


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