結果

問題 No.106 素数が嫌い!2
コンテスト
ユーザー tkzw_21
提出日時 2014-12-19 00:03:42
言語 C++11
(gcc 15.3.0 + boost 1.92.0)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1,102 ms / 5,000 ms
+ 458µs
コード長 506 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 565 ms
コンパイル使用メモリ 106,540 KB
実行使用メモリ 9,916 KB
最終ジャッジ日時 2026-11-20 19:41:25
合計ジャッジ時間 11,121 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <cmath>
#include <vector>
#include <utility>
#include <queue>
#include <map>
#include <algorithm>

using namespace std;

int prime_factor(int n){
	map<int,int>res;
	int cnt = 0;
	for(int i=2;i*i<=n;i++){
		while(n%i==0){
			++res[i];
			if(res[i] == 1)cnt++;
			n /= i;
		}
	}
	if(n!=1){
		res[n]=1;
		cnt++;
	}
	return cnt;
}

int main(void){
	int n,k;
	cin >> n >> k;
	int ret =0;
	for(int i=2;i<=n;i++){
		if(prime_factor(i) >= k)ret++;
	}
	cout << ret << endl;
	return 0;
}
0