結果

問題 No.106 素数が嫌い!2
ユーザー GrenacheGrenache
提出日時 2015-11-23 20:00:19
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 644 bytes
コンパイル時間 3,139 ms
コンパイル使用メモリ 71,944 KB
実行使用メモリ 62,544 KB
最終ジャッジ日時 2023-10-11 18:23:12
合計ジャッジ時間 6,372 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 124 ms
55,940 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 154 ms
62,128 KB
testcase_07 AC 153 ms
61,872 KB
testcase_08 WA -
testcase_09 AC 136 ms
55,484 KB
testcase_10 AC 153 ms
62,544 KB
testcase_11 AC 147 ms
58,484 KB
testcase_12 WA -
testcase_13 AC 125 ms
55,784 KB
testcase_14 AC 123 ms
56,048 KB
testcase_15 AC 124 ms
55,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main_yukicoder106 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int k = sc.nextInt();

        int[] cnt = new int[Math.max(3 + 1, n + 1)];
        for (int i = 2; i * i <= Math.max(9, n); i++) {
        	if (cnt[i] == 0) {
        		for (int j = 1; i * j <= n; j++) {
        			cnt[i * j]++;
        		}
        	}
        }

        int ret = 0;
        for (int i = 2; i <= n; i++) {
        	if (cnt[i] >= k) {
        		ret++;
        	}
        }

        System.out.println(ret);

        sc.close();
    }
}
0