結果

問題 No.106 素数が嫌い!2
ユーザー なお
提出日時 2014-12-18 23:25:34
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 932 ms / 5,000 ms
コード長 649 bytes
コンパイル時間 1,659 ms
コンパイル使用メモリ 157,688 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-12 01:17:40
合計ジャッジ時間 8,239 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n)           for(int(i)=0;(i)<(n);++(i))
const int MOD = 1000000007;

// 素因数分解
int pdecomp(unsigned int n){
    int res = 0;
    unsigned int e = 0; while(n % 2 == 0){ n /= 2, e++; }
    if(e) res++;
    for(unsigned int p = 3; p*p <= n; p += 2){
        unsigned int e = 0; while(n % p == 0){ n /= p, e++; }
        if(e) res++;
    }
    if(n != 1) res++;
    return res;
}

int main(){
    int N, K;
    cin >> N >> K;

    int res = 0;
    for(int i = 2; i <= N; i++){
        if(pdecomp(i) >= K) res++;
    }

    cout << res << endl;
    return 0;
}
0