結果
問題 | No.300 平方数 |
ユーザー |
![]() |
提出日時 | 2020-02-28 00:15:17 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 12 ms / 1,000 ms |
コード長 | 752 bytes |
コンパイル時間 | 890 ms |
コンパイル使用メモリ | 78,312 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 16:07:35 |
合計ジャッジ時間 | 2,280 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 43 |
ソースコード
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <ctime> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <vector> #define rep(i,n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int,int>; using namespace std; const int MOD = 1000000007; // 10^9 + 7 int main() { cin.tie(0); ios::sync_with_stdio(false); ll x; cin >> x; ll ans = 1, d = 2, y = x; for (ll d = 2; d * d <= x && y > 0; d++) { int cnt = 0; while (y % d == 0) { y /= d; cnt += 1; } if (cnt % 2 == 1) ans *= d; } if (y > 0) { ans *= y; } cout << ans << endl; }