結果

問題 No.106 素数が嫌い!2
ユーザー maimai
提出日時 2018-01-23 20:07:56
言語 cLay
(20240104-1)
結果
WA  
実行時間 -
コード長 434 bytes
コンパイル時間 1,818 ms
コンパイル使用メモリ 161,928 KB
実行使用メモリ 10,816 KB
最終ジャッジ日時 2023-09-18 23:53:08
合計ジャッジ時間 2,786 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 2 ms
4,384 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 13 ms
10,700 KB
testcase_07 AC 14 ms
10,816 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,384 KB
testcase_10 AC 14 ms
10,692 KB
testcase_11 AC 7 ms
6,344 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

void gen_primelist(vector<int>& out, ll high) {
    out.resize(high + 1);
    out[0] = out[1] = 1;
    ll sqh = (ll)sqrt(high);
    for (ll i = 2; i <= sqh; i++) {
        if (out[i] == 0) {
            for (ll j = i*2; j <= high; j += i) { // i*i
                out[j] += 1;
            }
        }
    }
}


{
    ll N,K;rd(N,K);
    vector<int> p;
    gen_primelist(p,N);
    ll cnt=0;
    REP(i,N+1) cnt+=p[i]>=K;
    wt(cnt);
}
0