結果
問題 |
No.300 平方数
|
ユーザー |
|
提出日時 | 2022-09-09 03:56:51 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 12 ms / 1,000 ms |
コード長 | 563 bytes |
コンパイル時間 | 1,465 ms |
コンパイル使用メモリ | 167,296 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-25 01:24:46 |
合計ジャッジ時間 | 2,815 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 43 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define all(a) begin(a), end(a) #define sz(x) (int)((x).size()) #ifdef LOCAL #include "debug.hpp" #else #define debug(...) 42 #endif void solve() { ll n; cin >> n; ll ans = 1; for (ll x = 2; x * x <= n; x++) if (n % x == 0) { int e = 0; while (n % x == 0) n /= x, e += 1; if (e & 1) ans *= x; } if (n != 1LL) ans *= n; cout << ans << '\n'; } int main() { cin.tie(nullptr)->sync_with_stdio(false); int T = 1; // cin >> T; while (T--) solve(); return 0; }