結果

問題 No.106 素数が嫌い!2
ユーザー tottoripaper
提出日時 2015-03-04 22:53:45
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 431 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 23,168 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-24 07:47:01
合計ジャッジ時間 35,284 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 TLE * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |     scanf("%lld %d", &N, &K);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <cstdio>

typedef long long ll;

int main(){
    ll N;
    int K;
    scanf("%lld %d", &N, &K);

    int res = 0;
    for(ll i=2;i<=N;i++){
        ll x = i;
        int count = 0;
        for(ll j=2;j*j<x;j++){
            if(x % j == 0){count++;}
            while(x % j == 0){x /= j;}
        }
        if(x > 1){count++;}
        
        if(count >= K){
            res++;
        }
    }

    printf("%d\n", res);
}
0