結果

問題 No.106 素数が嫌い!2
ユーザー tkzw_21tkzw_21
提出日時 2014-12-19 00:00:54
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 505 bytes
コンパイル時間 693 ms
コンパイル使用メモリ 78,264 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-09-02 18:59:00
合計ジャッジ時間 15,866 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 2,210 ms
4,368 KB
testcase_06 AC 2,213 ms
4,368 KB
testcase_07 AC 2,212 ms
4,368 KB
testcase_08 AC 64 ms
4,368 KB
testcase_09 AC 70 ms
4,372 KB
testcase_10 AC 2,210 ms
4,372 KB
testcase_11 AC 735 ms
4,368 KB
testcase_12 AC 2,092 ms
4,372 KB
testcase_13 WA -
testcase_14 AC 2 ms
4,372 KB
testcase_15 AC 2 ms
4,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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