結果

問題 No.136 Yet Another GCD Problem
ユーザー tenten
提出日時 2020-11-17 20:31:23
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 567 bytes
コンパイル時間 2,117 ms
コンパイル使用メモリ 77,140 KB
実行使用メモリ 56,272 KB
最終ジャッジ日時 2024-07-23 08:27:13
合計ジャッジ時間 8,822 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 25
権限があれば一括ダウンロードができます

ソースコード

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