結果

問題 No.300 平方数
ユーザー evawenis
提出日時 2020-06-25 15:50:48
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 12 ms / 1,000 ms
コード長 344 bytes
コンパイル時間 1,880 ms
コンパイル使用メモリ 198,980 KB
最終ジャッジ日時 2025-01-11 10:12:31
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int64_t x; cin>>x;
	unordered_map<int64_t,int>m;
	for(int64_t i=2;i*i<=x;++i){
		if(x%i)continue;
		while(x%i==0){
			++m[i];
			x/=i;
		}
	}
	if(x>1)++m[x];
	int64_t ans=1;
	for(auto&&i:m){
		if(i.second%2)ans*=i.first;
	}
	cout<<ans<<"\n"s;
}
0