結果

問題 No.106 素数が嫌い!2
コンテスト
ユーザー kou6839
提出日時 2014-12-20 20:16:55
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
AC  
実行時間 1,874 ms / 5,000 ms
+ 201µs
コード長 547 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,224 ms
コンパイル使用メモリ 83,796 KB
実行使用メモリ 44,916 KB
最終ジャッジ日時 2026-07-25 21:51:10
合計ジャッジ時間 15,101 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.math.*;
import java.util.*;

class Main{
	
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int ans=0;
        for(int i=2;i<=n;i++){
        	int num=i;
        	int temp=0;
        	for(int j=2;j*j<=num;j++){
        		if(num%j==0) temp++;
        		while(num%j==0){
        			num/=j;
        		}
        	}
        	if(num>1) temp++;
        	if(temp>=k) ans++;
        	
        }
        System.out.println(ans);
    }
}
0