結果
問題 | No.106 素数が嫌い!2 |
ユーザー |
|
提出日時 | 2014-12-20 19:57:53 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 152 ms / 5,000 ms |
コード長 | 369 bytes |
コンパイル時間 | 3,406 ms |
コンパイル使用メモリ | 74,168 KB |
実行使用メモリ | 49,156 KB |
最終ジャッジ日時 | 2024-06-12 02:35:22 |
合計ジャッジ時間 | 5,732 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
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); } }