結果

問題 No.106 素数が嫌い!2
ユーザー Naoyk1212Naoyk1212
提出日時 2016-08-09 13:56:53
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 44 ms / 5,000 ms
コード長 359 bytes
コンパイル時間 1,291 ms
コンパイル使用メモリ 159,316 KB
実行使用メモリ 18,944 KB
最終ジャッジ日時 2024-04-24 22:59:19
合計ジャッジ時間 1,932 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
11,008 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 18 ms
11,008 KB
testcase_05 AC 42 ms
18,816 KB
testcase_06 AC 41 ms
18,944 KB
testcase_07 AC 41 ms
18,816 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 43 ms
18,688 KB
testcase_11 AC 15 ms
9,984 KB
testcase_12 AC 44 ms
18,176 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
  int n, k;
  cin >> n >> k;
  vector<long long> a(n + 1, 0);
  for(long long i = 2; i <= n; i++){
    if(a[i] == 0){
      for(long long j = i; j <= n; j += i){
        a[j]++;
      }
    }
  }
  int count = 0;
  for(int i = 0; i <= n; i++){
    if(a[i] >= k)count++;
  }
  cout << count << endl;
}
0