結果

問題 No.106 素数が嫌い!2
ユーザー 37zigen37zigen
提出日時 2016-05-20 12:33:55
言語 Java21
(openjdk 21)
結果
AC  
実行時間 180 ms / 5,000 ms
コード長 463 bytes
コンパイル時間 2,196 ms
コンパイル使用メモリ 74,104 KB
実行使用メモリ 49,208 KB
最終ジャッジ日時 2024-04-16 01:48:14
合計ジャッジ時間 5,173 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
44,360 KB
testcase_01 AC 114 ms
40,020 KB
testcase_02 AC 127 ms
41,380 KB
testcase_03 AC 125 ms
41,088 KB
testcase_04 AC 148 ms
45,468 KB
testcase_05 AC 167 ms
49,168 KB
testcase_06 AC 167 ms
49,068 KB
testcase_07 AC 169 ms
49,208 KB
testcase_08 AC 122 ms
41,152 KB
testcase_09 AC 136 ms
41,928 KB
testcase_10 AC 157 ms
48,664 KB
testcase_11 AC 151 ms
44,848 KB
testcase_12 AC 180 ms
48,692 KB
testcase_13 AC 113 ms
39,880 KB
testcase_14 AC 113 ms
40,040 KB
testcase_15 AC 118 ms
40,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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