92pts,为什么mle
查看原帖
92pts,为什么mle
1270926
wawatime1楼主2024/11/10 18:10
#include <bits/stdc++.h>
#define int long long
using namespace std;
int k, n, a[110], t = 1;
priority_queue <int, vector <int>, greater <int>> q;
signed main () {
	scanf ("%lld%lld", &k, &n);
	for (int i = 1; i <= k; i++) {
		int x;
		scanf ("%lld", &x);
		a[i] = x;
		q.push (x);
	}
	sort (a + 1, a + 1 + k);
	int i = 1;
	while (t < n) {
		int to = q.top();
		while (!q.empty() && to == q.top())
			q.pop();
		for (i = 1; i <= k; i++)
			if (to % a[i] == 0)
				break;
		for (; i <= k; i++) {
			q.push (to * a[i]);
		}
		t++;
	}
	printf ("%lld", q.top());
	return 0;
}
2024/11/10 18:10
加载中...