結果

問題 No.106 素数が嫌い!2
ユーザー finefine
提出日時 2016-03-15 19:12:25
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 31 ms / 5,000 ms
コード長 372 bytes
コンパイル時間 1,465 ms
コンパイル使用メモリ 159,240 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-04-08 13:23:26
合計ジャッジ時間 2,518 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
    int a[2000000] = {0},n,x;
    long long ans = 0;
    cin >> n >> x;
    for(int i = 2; i <= n; i++){
        if (a[i - 2] == 0) {
            for(int k = i; k <= n; k += i) {
                a[k - 2]++;
            }
        }
        if (a[i - 2] >= x) ans++;
    }
    cout << ans << "\n";
    return 0;
}
0