結果

問題 No.106 素数が嫌い!2
ユーザー xxxasdfghjk
提出日時 2019-04-11 16:14:29
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 27 ms / 5,000 ms
コード長 398 bytes
コンパイル時間 1,266 ms
コンパイル使用メモリ 157,900 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-07-18 15:33:52
合計ジャッジ時間 2,356 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int memo[2000002];
int main(){
  int N,K;
  cin >> N >> K;
  for(int i=0;i<2000002;i++){
    memo[i] = 0;
  }
  for(int i=2;i<2000002;i++){
    if(memo[i] == 0){
      for(int j=i;j<2000002;j+=i)
        memo[j] += 1;
    }
  }
  int res = 0;
  for(int i=2;i<=N;i++){
    if(memo[i] >= K)
      res++;
  }
  cout << res << endl;
}
0