結果

問題 No.1063 ルートの計算 / Sqrt Calculation
ユーザー udonmanudonman
提出日時 2020-05-29 21:25:04
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,284 bytes
コンパイル時間 886 ms
コンパイル使用メモリ 90,892 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-23 20:05:42
合計ジャッジ時間 1,536 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#include <iomanip>
#define ll long long int
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
ll INF = (1 << 30);
ll MOD = 1e9 + 7;

vector<int> par;
vector<int> RANK;
void init(int n){
    for(int i = 0; i < n; i++){
        par.pb(i);
        RANK.pb(0);
    }return;
}

int FindRoot(int x){
    if(par[x] == x) return x;
    par[x] = FindRoot(par[x]);
    return par[x];
}

bool isSame(int x, int y){
    return FindRoot(x) == FindRoot(y);
}

void Union(int x, int y) {
    x = FindRoot(x);
    y = FindRoot(y);
    if (x == y) return;
    if (RANK[x] > RANK[y]) par[y] = x;
    else {
        par[x] = y;
        if (RANK[x] == RANK[y]) {
            RANK[y]++;
        }
    }
    return;
}

int main() {
    ll n; cin >> n;
    ll b = n;
    for(ll i = 1; i * i <= n; i++){
        if(n % (i * i) == 0){
            b = min(b,n / (i * i));
        }
    }
    cout << sqrt(n / b) << " " << b << endl;
}
0