結果

問題 No.106 素数が嫌い!2
ユーザー ldsybldsyb
提出日時 2017-06-25 20:17:36
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 26 ms / 5,000 ms
コード長 279 bytes
コンパイル時間 534 ms
コンパイル使用メモリ 64,820 KB
実行使用メモリ 11,412 KB
最終ジャッジ日時 2024-04-15 01:39:11
合計ジャッジ時間 1,422 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
7,448 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 12 ms
7,372 KB
testcase_05 AC 26 ms
11,236 KB
testcase_06 AC 25 ms
11,412 KB
testcase_07 AC 24 ms
11,392 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 3 ms
5,376 KB
testcase_10 AC 26 ms
11,392 KB
testcase_11 AC 12 ms
7,168 KB
testcase_12 AC 25 ms
11,104 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int main(){
	int n, k;
	cin >> n >> k;
	int ans = 0, puni[n + 1]{};
	for(int i = 2; i <= n; i++){
		if(puni[i] == 0){
			for(int j = 2 * i; j <= n; j += i) puni[j]++;
			puni[i]++;
		}
		if(k <= puni[i]) ans++;
	}
	cout << ans << endl;
}
0