結果
問題 | No.300 平方数 |
ユーザー |
![]() |
提出日時 | 2021-02-13 14:44:12 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 13 ms / 1,000 ms |
コード長 | 452 bytes |
コンパイル時間 | 1,612 ms |
コンパイル使用メモリ | 172,088 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-20 17:35:50 |
合計ジャッジ時間 | 3,207 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 43 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ ll n; cin >> n; ll num = n; vector<pair<ll, int>> P; for(ll i = 2; i*i <=n ;i++){ int x = 0; while(num%i ==0){ num /= i; x++; } if(x >=1) P.emplace_back(i, x); } if( num !=1) P.emplace_back(num, 1); ll ans = 1; for(auto x : P){ if(x.second%2==1) ans *= x.first; } cout << ans << endl; return 0; }