// No.300 平方数 // https://yukicoder.me/problems/no/300 // #include #include using namespace std; long long int solve(long long int X); unordered_map prime_factor(long long int X); int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); long long X; cin >> X; long long ans = solve(X); cout << ans << endl; } long long int solve(long long int X) { unordered_map res; res = prime_factor(X); long long ans = 1; for (auto f: res) { if (f.second % 2 == 1) { ans *= f.first; } } return ans; } unordered_map prime_factor(long long int X) { unordered_map res; for (long long i = 2; i*i <= X; ++i) { while (X % i == 0) { ++res[i]; X /= i; } } if (X != 1) res[X] = 1; return res; }