結果

問題 No.106 素数が嫌い!2
ユーザー xxxasdfghjkxxxasdfghjk
提出日時 2019-04-11 16:12:46
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 395 bytes
コンパイル時間 1,085 ms
コンパイル使用メモリ 143,340 KB
実行使用メモリ 4,428 KB
最終ジャッジ日時 2023-09-25 19:39:30
合計ジャッジ時間 2,105 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 3 ms
4,380 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 3 ms
4,428 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 7 ms
4,376 KB
testcase_08 AC 3 ms
4,380 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 7 ms
4,380 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 3 ms
4,376 KB
testcase_14 AC 3 ms
4,376 KB
testcase_15 AC 3 ms
4,380 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<200002;i++){
    memo[i] = 0;
  }
  for(int i=2;i<200002;i++){
    if(memo[i] == 0){
      for(int j=i;j<200002;j+=i)
        memo[j] += 1;
    }
  }
  int res = 0;
  for(int i=2;i<=N;i++){
    if(memo[i] >= K)
      res++;
  }
  cout << res << endl;
}
0