結果

問題 No.106 素数が嫌い!2
ユーザー kano_townkano_town
提出日時 2014-12-20 19:57:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 159 ms / 5,000 ms
コード長 369 bytes
コンパイル時間 5,431 ms
コンパイル使用メモリ 72,564 KB
実行使用メモリ 62,424 KB
最終ジャッジ日時 2023-09-02 20:12:32
合計ジャッジ時間 7,113 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 142 ms
59,936 KB
testcase_01 AC 120 ms
55,844 KB
testcase_02 AC 122 ms
55,740 KB
testcase_03 AC 126 ms
55,688 KB
testcase_04 AC 146 ms
62,212 KB
testcase_05 AC 157 ms
61,648 KB
testcase_06 AC 157 ms
62,424 KB
testcase_07 AC 159 ms
61,960 KB
testcase_08 AC 133 ms
55,828 KB
testcase_09 AC 132 ms
56,104 KB
testcase_10 AC 156 ms
61,788 KB
testcase_11 AC 148 ms
58,324 KB
testcase_12 AC 154 ms
62,148 KB
testcase_13 AC 121 ms
55,824 KB
testcase_14 AC 122 ms
55,928 KB
testcase_15 AC 121 ms
56,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Yukicoder106 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt(), k=sc.nextInt(), res=0;
		int[] cnt = new int[n+1];
		for (int i=2; i<=n; i++) if (cnt[i]==0) for (int j=1; i*j<=n; j++) cnt[i*j]++;
		for (int i=2; i<=n; i++) if (cnt[i]>=k) res++;
		System.out.println(res);
	}
}
0