結果

問題 No.106 素数が嫌い!2
ユーザー HAHAHAHAHAHA
提出日時 2016-09-08 11:41:01
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 20 ms / 5,000 ms
コード長 305 bytes
コンパイル時間 1,267 ms
コンパイル使用メモリ 160,392 KB
実行使用メモリ 10,996 KB
最終ジャッジ日時 2024-04-27 17:57:11
合計ジャッジ時間 1,889 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
7,148 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 10 ms
7,116 KB
testcase_05 AC 20 ms
10,996 KB
testcase_06 AC 20 ms
10,840 KB
testcase_07 AC 19 ms
10,992 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 3 ms
6,940 KB
testcase_10 AC 19 ms
10,912 KB
testcase_11 AC 9 ms
6,940 KB
testcase_12 AC 18 ms
10,528 KB
testcase_13 AC 1 ms
6,944 KB
testcase_14 AC 1 ms
6,940 KB
testcase_15 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
	int n,k;
	cin >> n >> k;
	vector<int> v(n+1);
	
	for(int i=2;i<=n;i++){
		if(v[i]==0){
			for(int j=i;j<=n;j+=i){
				v[j]++;
			}
		}
	}
	
	int cnt=0;
	for(int i=2;i<=n;i++){
		if(v[i]>=k){
			cnt++;
		}
	}
	
	cout << cnt << endl;
	
	return 0;
}
0