Files
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

19 lines
508 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <bits/stdc++.h>
typedef long long LL;
using namespace std;
int main() {
LL n; // 使用long long确保处理大数值时不溢出
cin >> n;
// 从2开始查找最小质因数
for (LL i = 2; i * i <= n; ++i) {
if (n % i == 0) {
// 找到最小质因数i,较大的质数为n/i
cout << n / i << endl;
return 0;
}
}
// 理论上不会执行到这里,因为n是两个不同质数的乘积
return 0;
}