結果
| 問題 |
No.300 平方数
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-12-21 06:32:51 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 7 ms / 1,000 ms |
| コード長 | 687 bytes |
| コンパイル時間 | 1,324 ms |
| コンパイル使用メモリ | 162,836 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-17 21:16:21 |
| 合計ジャッジ時間 | 2,619 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 43 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(int(i)=0;(i)<(n);++(i))
#define in(T,V) T V;cin>>V;
vector<pair<ll,int> > pdecomp(ll n){
vector<pair<ll,int> > res;
int e = 0; while(n % 2 == 0){ n /= 2, e++; }
if(e) res.push_back(make_pair(2,e));
for(ll p = 3; p*p <= n; p += 2){
int e = 0; while(n % p == 0){ n /= p, e++; }
if(e) res.push_back(make_pair(p,e));
}
if(n != 1) res.push_back(make_pair(n,1));
return res;
}
int main(){
in(ll,x);
vector<pair<ll,int> > p = pdecomp(x);
ll res = 1;
for(auto v : p){
if(v.second % 2) res *= v.first;
}
cout << res << endl;
}