結果

問題 No.106 素数が嫌い!2
ユーザー knewknowl
提出日時 2015-02-10 12:37:32
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 32 ms / 5,000 ms
コード長 336 bytes
コンパイル時間 659 ms
コンパイル使用メモリ 56,312 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-06-23 16:58:52
合計ジャッジ時間 1,385 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

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