結果

問題 No.106 素数が嫌い!2
ユーザー fine
提出日時 2016-03-15 19:12:25
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 28 ms / 5,000 ms
コード長 372 bytes
コンパイル時間 1,460 ms
コンパイル使用メモリ 158,852 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-10-01 06:38:07
合計ジャッジ時間 2,184 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

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