結果

問題 No.106 素数が嫌い!2
ユーザー h_nosonh_noson
提出日時 2016-03-09 00:06:49
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 28 ms / 5,000 ms
コード長 629 bytes
コンパイル時間 485 ms
コンパイル使用メモリ 63,964 KB
実行使用メモリ 11,488 KB
最終ジャッジ日時 2023-10-24 20:56:23
合計ジャッジ時間 1,487 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
11,488 KB
testcase_01 AC 8 ms
11,488 KB
testcase_02 AC 7 ms
11,488 KB
testcase_03 AC 7 ms
11,488 KB
testcase_04 AC 14 ms
11,488 KB
testcase_05 AC 27 ms
11,488 KB
testcase_06 AC 28 ms
11,488 KB
testcase_07 AC 28 ms
11,488 KB
testcase_08 AC 8 ms
11,488 KB
testcase_09 AC 8 ms
11,488 KB
testcase_10 AC 27 ms
11,488 KB
testcase_11 AC 13 ms
11,488 KB
testcase_12 AC 26 ms
11,488 KB
testcase_13 AC 6 ms
11,488 KB
testcase_14 AC 6 ms
11,488 KB
testcase_15 AC 6 ms
11,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

#define RREP(i,s,e) for (i = e-1; i >= s; i--)
#define rrep(i,n) RREP(i,0,n)
#define REP(i,s,e) for (i = s; i < e; i++)
#define rep(i,n) REP(i,0,n)
#define INF 1e8

typedef long long ll;

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

0