結果

問題 No.106 素数が嫌い!2
ユーザー GoryudyumaGoryudyuma
提出日時 2017-03-23 08:00:02
言語 Java19
(openjdk 21)
結果
TLE  
実行時間 -
コード長 1,045 bytes
コンパイル時間 2,202 ms
コンパイル使用メモリ 71,180 KB
実行使用メモリ 64,056 KB
最終ジャッジ日時 2023-09-19 08:35:34
合計ジャッジ時間 14,840 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

import java.util.*;

class Main {
        public static void main(String args[]) {
                try (Scanner sc = new Scanner(System.in)) {
                        int N = sc.nextInt(), K = sc.nextInt(), ans = 0;
                        for (int i = 2; i <= N; i++) {
                                int j = i, now = 2, count = 0;
                                while (j != 1) {
                                        if (j % now == 0) {
                                                while (j % now == 0) {
                                                        j /= now;
                                                }
                                                count++;
                                        }
                                        now++;
                                }
                                if (count >= K) {
                                        ans++;
                                }
                        }
                        System.out.println(ans);
                }
        }
}
0