結果

問題 No.106 素数が嫌い!2
ユーザー Goryudyuma
提出日時 2017-03-23 08:00:02
言語 Java
(openjdk 23)
結果
TLE  
実行時間 -
コード長 1,045 bytes
コンパイル時間 2,287 ms
コンパイル使用メモリ 74,360 KB
実行使用メモリ 46,428 KB
最終ジャッジ日時 2024-07-05 20:24:36
合計ジャッジ時間 14,449 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other TLE * 1 -- * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main {
        public static void main(String args[]) {
                try (Scanner sc = new Scanner(System.in)) {
                        int N = sc.nextInt(), K = sc.nextInt(), ans = 0;
                        for (int i = 2; i <= N; i++) {
                                int j = i, now = 2, count = 0;
                                while (j != 1) {
                                        if (j % now == 0) {
                                                while (j % now == 0) {
                                                        j /= now;
                                                }
                                                count++;
                                        }
                                        now++;
                                }
                                if (count >= K) {
                                        ans++;
                                }
                        }
                        System.out.println(ans);
                }
        }
}
0