Problem - 1242A - Codeforces
题意:
思路:
Code:
#include <bits/stdc++.h>
#define int long long
using i64 = long long;
constexpr int N = 2e3 + 10;
constexpr int M = 2e3 + 10;
constexpr int mod = 998244353;
constexpr int Inf = 1e18;
void solve() {
int n;
std::cin >> n;
std::vector<std::array<int,2> > V;
for (int i = 2; i <= n / i; i ++) {
if (n % i == 0) {
int s = 0;
while (n % i == 0) {
n /= i;
s ++;
}
V.push_back({i, s});
}
}
if (n > 1) V.push_back({n, 1});
if (V.size() == 0) {
std::cout << n << "\n";
}else if (V.size() == 1) {
std::cout << V[0][0] << "\n";
}else {
std::cout << 1 << "\n";
}
}
signed main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int t = 1;
while (t--) {
solve();
}
return 0;
}