結果
問題 |
No.106 素数が嫌い!2
|
ユーザー |
|
提出日時 | 2019-01-26 06:21:51 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,773 ms / 5,000 ms |
コード長 | 434 bytes |
コンパイル時間 | 1,473 ms |
コンパイル使用メモリ | 166,636 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-16 04:54:19 |
合計ジャッジ時間 | 13,610 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; int ans = 0; auto cnt = [] (int x) { int c = 0; for (int p = 2; p * p <= x; p++) { c += x % p == 0; while (x % p == 0) { x /= p; } } c += x != 1; return c; }; for (int i = 2; i <= n; i++) { ans += cnt(i) >= k; } cout << ans << '\n'; return 0; }