結果

問題 No.300 平方数
ユーザー SeiyaTSeiyaT
提出日時 2021-09-10 17:47:27
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 12 ms / 1,000 ms
コード長 508 bytes
コンパイル時間 1,628 ms
コンパイル使用メモリ 171,340 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-11 16:42:49
合計ジャッジ時間 3,269 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using ll=long long;
ll mod=1000000007;
ll INF=1LL<<60;

vector<pair<ll,ll>> prime_factorize(ll N){
	vector<pair<ll,ll>> res;
	for(ll a=2;a*a<=N;a++){
		if(N%a!=0)continue;
		ll ex=0;
		while(N%a==0){
			ex++;
			N/=a;
		}
		res.push_back({a,ex});
	}
	if(N!=1)res.push_back({N,1});
	return res;
}

int main() {
	ll X,Y=1;
	cin >> X;
	auto P=prime_factorize(X);
	for(int i=0;i<P.size();i++){
		if(P[i].second%2==1){
			Y*=P[i].first;
		}
	}
	cout << Y << endl;
}
0