0分求调
查看原帖
0分求调
1427588
zhou_yu_cheng楼主2025/7/31 19:26
#include<bits/stdc++.h>
using namespace std;
long long n, m;
bool f(long long n) {
	for (long long i = 1; i < n; i++) {
		if (n % i == 0) {
			if ((long long)sqrt(n / i) * (long long)sqrt(n / i) == n / i) {
				return true;
			}
		}
	}
	return false;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> m;
	for (long long i = 1; i <= m; i++) {
		long long t;
		cin >> t;
		long long q = sqrt(t);
		if (t >= n && f(t)) cout << "lucky\n";
		else cout << t + 3 << "\n";
	}
	return 0;
}
2025/7/31 19:26
加载中...