結果

問題 No.106 素数が嫌い!2
ユーザー knewknowlknewknowl
提出日時 2015-02-10 12:37:32
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 35 ms / 5,000 ms
コード長 336 bytes
コンパイル時間 402 ms
コンパイル使用メモリ 59,100 KB
実行使用メモリ 11,280 KB
最終ジャッジ日時 2023-09-05 21:39:16
合計ジャッジ時間 1,467 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
7,232 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 14 ms
7,252 KB
testcase_05 AC 34 ms
11,116 KB
testcase_06 AC 32 ms
11,072 KB
testcase_07 AC 31 ms
11,280 KB
testcase_08 AC 3 ms
4,380 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 32 ms
11,156 KB
testcase_11 AC 12 ms
6,952 KB
testcase_12 AC 35 ms
10,828 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
using namespace std;
int n,k;
int tbl[2000010];
void solve(){
  for(int i=2;i<=n;++i){
    if(!tbl[i]){
      for(int j=1;i*j<=n;++j) tbl[i*j]++;
    }
  }
  int cnt = 0;
  for(int i=2;i<=n;++i) if(tbl[i]>=k) ++cnt;
  cout << cnt << endl;
}
int main(){
  cin >> n >> k;
  solve();
  return 0;
}
0