結果
問題 | No.1063 ルートの計算 / Sqrt Calculation |
ユーザー |
![]() |
提出日時 | 2020-05-29 21:35:19 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 139 ms / 2,000 ms |
コード長 | 787 bytes |
コンパイル時間 | 1,787 ms |
コンパイル使用メモリ | 196,040 KB |
最終ジャッジ日時 | 2025-01-10 16:38:37 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main(){ios::sync_with_stdio(false);cin.tie(nullptr);int n;cin >> n;vector<bool> is_prime(n + 1);int a = 1, b = 1;is_prime[0] = is_prime[1] = false;int i;for (i = 2; i * i <= n; ++i){if (n % i == 0){int ret = 1;int cnt = 0;while (n % i == 0){ret *= i;n /= i;++cnt;}if (cnt & 1){b *= i;}while (cnt > 0){ret /= i;cnt -= 2;}a *= ret;}}b *= n;cout << a << " " << b << '\n';return 0;}