結果

問題 No.106 素数が嫌い!2
ユーザー けーむけーむ
提出日時 2020-06-26 10:56:18
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 28 ms / 5,000 ms
コード長 920 bytes
コンパイル時間 1,372 ms
コンパイル使用メモリ 165,728 KB
実行使用メモリ 18,852 KB
最終ジャッジ日時 2023-09-16 23:36:14
合計ジャッジ時間 2,705 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
10,692 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 13 ms
10,816 KB
testcase_05 AC 24 ms
18,644 KB
testcase_06 AC 24 ms
18,720 KB
testcase_07 AC 26 ms
18,852 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 28 ms
18,792 KB
testcase_11 AC 12 ms
10,068 KB
testcase_12 AC 28 ms
17,868 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n, k;
    cin >> n >> k;
    vector<ll> cnt(n + 1, 0);
    reps(i, 2, n + 1) {
        if (cnt[i] != 0) continue;
        for(ll j = i; j <= n; j += i) {
            cnt[j]++;
        }
    }
    ll ans = 0;
    reps(i, 2, n + 1) {
        if (cnt[i] >= k) ans++;
    }
    cout << ans << endl;
    return 0;
}
0