結果
問題 |
No.300 平方数
|
ユーザー |
|
提出日時 | 2020-06-03 21:57:07 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 29 ms / 1,000 ms |
コード長 | 707 bytes |
コンパイル時間 | 2,805 ms |
コンパイル使用メモリ | 197,852 KB |
最終ジャッジ日時 | 2025-01-10 20:53:39 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++) #define ALL(x) (x).begin(), (x).end() const double PI = acos(-1); map<long long, int> factorize(long long n) { map<long long, int> ret; for (long long i = 2; i * i <= n; i++) { while (n % i == 0) { ++ret[i]; n /= i; } } if (n != 1) ret[n] = 1; return ret; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long x, y; cin >> x; y = 1; map<long long, int> f = factorize(x); for (auto pr: f) { if (pr.second % 2) y *= pr.first; } cout << y << endl; return 0; }