結果

問題 No.106 素数が嫌い!2
ユーザー woodsgreenwoodsgreen
提出日時 2022-01-13 21:25:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 29 ms / 5,000 ms
コード長 313 bytes
コンパイル時間 2,094 ms
コンパイル使用メモリ 199,412 KB
実行使用メモリ 11,272 KB
最終ジャッジ日時 2024-04-28 19:23:28
合計ジャッジ時間 3,041 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
7,520 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 11 ms
8,116 KB
testcase_05 AC 25 ms
11,148 KB
testcase_06 AC 25 ms
11,196 KB
testcase_07 AC 26 ms
11,228 KB
testcase_08 AC 3 ms
6,944 KB
testcase_09 AC 3 ms
6,944 KB
testcase_10 AC 25 ms
11,272 KB
testcase_11 AC 10 ms
6,984 KB
testcase_12 AC 29 ms
10,784 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int n,k,a[2000010],ans;
int main(){
    cin>>n>>k;
    for(int i=2;i<=n;++i)
        if(a[i]==0)
            for(int j=i;j<=n;j+=i)
                ++a[j];
    for(int i=2;i<=n;++i)
        if(a[i]>=k)
            ++ans;
    cout<<ans;
    return 0;
}
0