結果

問題 No.106 素数が嫌い!2
ユーザー momoyuu
提出日時 2023-10-24 17:48:55
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 25 ms / 5,000 ms
コード長 410 bytes
コンパイル時間 3,082 ms
コンパイル使用メモリ 246,436 KB
実行使用メモリ 11,076 KB
最終ジャッジ日時 2024-09-24 10:15:44
合計ジャッジ時間 3,847 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false); 

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

0