結果
問題 |
No.300 平方数
|
ユーザー |
![]() |
提出日時 | 2020-09-05 01:11:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 11 ms / 1,000 ms |
コード長 | 854 bytes |
コンパイル時間 | 1,735 ms |
コンパイル使用メモリ | 173,028 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-26 21:25:49 |
合計ジャッジ時間 | 3,181 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 43 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(),(x).end() typedef long long ll; typedef pair<ll, ll> P; const int mod = 1000000007; //出力は (ans % mod + mod) % mod (負の剰余を正にする) const int inf = 1e9; const long long INF = 1LL << 60; // INF = 11 map<ll,ll> prime_factors(ll n){ map<ll,ll> res; if(n == 1){ res[n] = 1; return res; } for(ll i = 2; i * i <= n; i++){ while(n % i == 0){ ++res[i]; n /= i; } } if(n != 1){ res[n] = 1; } return res; } int main() { ll x; cin >> x; map<ll,ll> m = prime_factors(x); ll ans = 1; for(auto i : m){ if(i.second % 2 == 1){ ans *= i.first; } } cout << ans << endl; }