結果

問題 No.300 平方数
ユーザー MayimgMayimg
提出日時 2018-11-28 12:13:53
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 465 bytes
コンパイル時間 1,751 ms
コンパイル使用メモリ 176,340 KB
実行使用メモリ 13,752 KB
最終ジャッジ日時 2024-06-26 11:14:54
合計ジャッジ時間 4,876 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 TLE * 1 -- * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#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, int> 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;                                              
}
	
0