結果

問題 No.1063 ルートの計算 / Sqrt Calculation
ユーザー simkaren
提出日時 2020-05-30 15:02:24
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 491 bytes
コンパイル時間 2,152 ms
コンパイル使用メモリ 177,548 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-07 17:17:23
合計ジャッジ時間 2,783 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("O3", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

pair<int, int> solve(int n){
    int a = 1, b = n;
    int i = 2;
    for (; i * i <= b; ++i){
        if (b % (i * i) == 0){
            a *= i, b /= i * i;
            i = 1;
        }
    }
    return {a, b};
}

int main(void){
    int n; cin >> n;
    pair<int, int> res = solve(n);
    cout << res.first << " " << res.second << endl;
    return 0;
}
0