結果

問題 No.1063 ルートの計算 / Sqrt Calculation
ユーザー kichi2004_kichi2004_
提出日時 2020-04-20 14:01:56
言語 Java21
(openjdk 21)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 480 bytes
コンパイル時間 2,232 ms
コンパイル使用メモリ 74,804 KB
実行使用メモリ 41,564 KB
最終ジャッジ日時 2024-04-16 00:36:37
合計ジャッジ時間 5,539 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
41,108 KB
testcase_01 AC 115 ms
40,220 KB
testcase_02 AC 129 ms
41,156 KB
testcase_03 AC 130 ms
41,544 KB
testcase_04 AC 117 ms
40,180 KB
testcase_05 AC 134 ms
41,292 KB
testcase_06 AC 134 ms
41,068 KB
testcase_07 AC 130 ms
41,340 KB
testcase_08 AC 130 ms
41,412 KB
testcase_09 AC 136 ms
41,296 KB
testcase_10 AC 135 ms
41,292 KB
testcase_11 AC 133 ms
41,288 KB
testcase_12 AC 136 ms
41,136 KB
testcase_13 AC 135 ms
41,268 KB
testcase_14 AC 119 ms
40,264 KB
testcase_15 AC 133 ms
41,564 KB
testcase_16 AC 132 ms
41,196 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if (n < 1 || n > 1000000000) return;

        int a = 1, b = n;
        for (int i = 1; i * i <= n; ++i) {
            int x = i * i;
            if (n % x != 0) continue;
            a = i;
            b = n / x;
        }

        System.out.printf("%d %d%n", a, b);
    }
}
0