結果

問題 No.106 素数が嫌い!2
ユーザー SSRSSSRS
提出日時 2020-09-03 07:26:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 387 bytes
コンパイル時間 575 ms
コンパイル使用メモリ 72,680 KB
実行使用メモリ 11,052 KB
最終ジャッジ日時 2023-08-14 17:51:02
合計ジャッジ時間 1,885 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 68 ms
11,016 KB
testcase_08 WA -
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 69 ms
10,788 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 1 ms
4,376 KB
testcase_15 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
int main(){
	int N, K;
	cin >> N >> K;
	vector<int> f(N + 1, 0);
	f[1] = 0;
	int ans = 0;
	for (int i = 2; i <= N; i++){
		for (int j = i; j <= N; j += i){
			if (f[j] == -1){
				int x = j;
				while (x % i == 0){
					x /= i;
				}
				f[j] = f[x] + 1;
				if (f[i] >= K){
					ans++;
				}
			}
		}
	}
	cout << ans << endl;
}
0