結果

問題 No.106 素数が嫌い!2
ユーザー rf141rf141
提出日時 2015-08-13 09:12:50
言語 Java21
(openjdk 21)
結果
AC  
実行時間 154 ms / 5,000 ms
コード長 468 bytes
コンパイル時間 3,341 ms
コンパイル使用メモリ 73,168 KB
実行使用メモリ 64,312 KB
最終ジャッジ日時 2023-09-25 11:25:26
合計ジャッジ時間 6,507 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 142 ms
60,460 KB
testcase_01 AC 120 ms
55,948 KB
testcase_02 AC 121 ms
56,376 KB
testcase_03 AC 122 ms
56,048 KB
testcase_04 AC 140 ms
60,024 KB
testcase_05 AC 154 ms
62,208 KB
testcase_06 AC 153 ms
62,044 KB
testcase_07 AC 151 ms
62,100 KB
testcase_08 AC 127 ms
56,044 KB
testcase_09 AC 135 ms
57,964 KB
testcase_10 AC 151 ms
64,312 KB
testcase_11 AC 141 ms
58,064 KB
testcase_12 AC 152 ms
62,016 KB
testcase_13 AC 121 ms
56,272 KB
testcase_14 AC 121 ms
55,952 KB
testcase_15 AC 122 ms
55,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class HatePrenum{
	public static void main(String... args){
		Scanner scan = new Scanner(System.in);
		HatePrenum hate = new HatePrenum();
		int N = scan.nextInt();
		int K = scan.nextInt();
		int[] d = new int[N+1];
		int res=0;
			for(int i = 2; i <= N; i++){
				if(d[i] == 0){
					for(int j = 1; i*j<=N; j++){
						d[i*j]++;
					}
				}
			}
			for(int i = 2; i <= N; i++){
				if(d[i]>=K)res++;
			}
			System.out.println(res);
		}
}
0