結果
| 問題 | 
                            No.300 平方数
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2018-11-28 12:14:57 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 471 bytes | 
| コンパイル時間 | 1,835 ms | 
| コンパイル使用メモリ | 175,144 KB | 
| 実行使用メモリ | 10,752 KB | 
| 最終ジャッジ日時 | 2024-06-26 11:15:00 | 
| 合計ジャッジ時間 | 4,457 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 20 TLE * 1 -- * 22 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	long long x; cin >> x;
	map<long long, long long> p_fac;
	for(int i = 2; i * i <= x; i++) {
		while(x % i == 0) {
			p_fac[i]++;
			x /= i;
		}
	}
	if(x != 1) p_fac[x]++;
	long long ans = 1;
	for(auto i : p_fac) {
		if(i.second % 2 == 1) ans *= i.first;
	}
	cout << ans << endl;
	return 0;                                              
}