結果

問題 No.136 Yet Another GCD Problem
ユーザー tentententen
提出日時 2020-11-17 20:31:23
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 567 bytes
コンパイル時間 4,417 ms
コンパイル使用メモリ 71,776 KB
実行使用メモリ 58,200 KB
最終ジャッジ日時 2023-09-30 14:24:50
合計ジャッジ時間 9,123 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,512 KB
testcase_01 AC 126 ms
55,508 KB
testcase_02 AC 125 ms
55,512 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 125 ms
55,928 KB
testcase_09 AC 127 ms
55,708 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 127 ms
55,756 KB
testcase_24 WA -
testcase_25 AC 127 ms
55,752 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 125 ms
55,992 KB
testcase_32 WA -
testcase_33 AC 125 ms
55,840 KB
testcase_34 AC 127 ms
57,764 KB
testcase_35 AC 125 ms
56,156 KB
testcase_36 AC 125 ms
56,028 KB
testcase_37 AC 125 ms
56,068 KB
testcase_38 AC 125 ms
55,808 KB
testcase_39 AC 123 ms
56,488 KB
testcase_40 AC 126 ms
57,928 KB
testcase_41 AC 130 ms
55,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int ans = 1;
        for (int i = 2; i <= Math.sqrt(n); i++) {
            if (n % i == 0) {
                if (n / i < k) {
                    break;
                }
                ans = i;
                if (i >= k) {
                    ans = n / i;
                    break;
                }
            }
        }
        System.out.println(ans);
    }
}
0