結果

問題 No.106 素数が嫌い!2
ユーザー koba-e964koba-e964
提出日時 2015-06-05 16:00:27
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 36 ms / 5,000 ms
コード長 386 bytes
コンパイル時間 335 ms
コンパイル使用メモリ 50,924 KB
実行使用メモリ 11,412 KB
最終ジャッジ日時 2023-09-20 19:16:16
合計ジャッジ時間 1,654 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
11,412 KB
testcase_01 AC 31 ms
11,196 KB
testcase_02 AC 31 ms
11,168 KB
testcase_03 AC 30 ms
11,160 KB
testcase_04 AC 31 ms
11,148 KB
testcase_05 AC 32 ms
11,148 KB
testcase_06 AC 32 ms
11,144 KB
testcase_07 AC 36 ms
11,344 KB
testcase_08 AC 30 ms
11,152 KB
testcase_09 AC 30 ms
11,236 KB
testcase_10 AC 32 ms
11,152 KB
testcase_11 AC 31 ms
11,260 KB
testcase_12 AC 32 ms
11,168 KB
testcase_13 AC 31 ms
11,312 KB
testcase_14 AC 31 ms
11,152 KB
testcase_15 AC 31 ms
11,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;

const int N = 2001000;
int dp[N];

int main(void){
  int n,k;
  cin >> n >> k;  
  REP (i, 2, N) {
    if (dp[i]) {
      continue;
    }
    for (int j = i; j < N; j += i) {
      dp[j]++;
    }
  }
  int cnt = 0;
  REP(i, 2, n + 1) {
    cnt += dp[i] >= k;
  }
  cout << cnt << endl;
}
0