結果

問題 No.106 素数が嫌い!2
ユーザー xxxasdfghjkxxxasdfghjk
提出日時 2019-04-11 16:14:28
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 32 ms / 5,000 ms
コード長 398 bytes
コンパイル時間 1,253 ms
コンパイル使用メモリ 143,392 KB
実行使用メモリ 11,284 KB
最終ジャッジ日時 2023-09-25 19:42:46
合計ジャッジ時間 2,599 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
11,192 KB
testcase_01 AC 25 ms
11,160 KB
testcase_02 AC 25 ms
11,140 KB
testcase_03 AC 25 ms
11,132 KB
testcase_04 AC 26 ms
11,132 KB
testcase_05 AC 29 ms
11,136 KB
testcase_06 AC 28 ms
11,152 KB
testcase_07 AC 27 ms
11,140 KB
testcase_08 AC 25 ms
11,132 KB
testcase_09 AC 25 ms
11,200 KB
testcase_10 AC 28 ms
11,140 KB
testcase_11 AC 26 ms
11,244 KB
testcase_12 AC 32 ms
11,280 KB
testcase_13 AC 25 ms
11,136 KB
testcase_14 AC 25 ms
11,224 KB
testcase_15 AC 25 ms
11,284 KB
権限があれば一括ダウンロードができます

ソースコード

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