题解

zhaoyonghao  •  1年前


#include <bits/stdc++.h>
using namespace std;

bool vis[20000005];
priority_queue < int > q;

int main()
{
	int n;
	cin >> n;
	q.push(-1);
	vis[1] = 1;
	int cnt = 0;
	while (!q.empty())
	{
		int now = q.top();
		q.pop(); 
		if (++cnt == n)
		{
			cout << -now << "\n";
			break;
		}
		if (!vis[-now * 2])
		{
			q.push(now * 2);
			vis[-now * 2] = 1;
		}
		if (!vis[-now * 3])
		{
			q.push(now * 3);
			vis[-now * 3] = 1;
		}
		if (!vis[-now * 5])
		{
			q.push(now * 5);
			vis[-now * 5] = 1;
		}
	}
	system("shutdown -p");
	return 0;
}

评论:

happy


zhaoyonghao  •  1年前