結果

問題 No.106 素数が嫌い!2
ユーザー beetbeet
提出日時 2018-10-05 17:12:05
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 26 ms / 5,000 ms
コード長 349 bytes
コンパイル時間 1,529 ms
コンパイル使用メモリ 162,596 KB
実行使用メモリ 11,972 KB
最終ジャッジ日時 2024-04-20 16:49:22
合計ジャッジ時間 2,586 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
11,856 KB
testcase_01 AC 24 ms
11,792 KB
testcase_02 AC 24 ms
11,620 KB
testcase_03 AC 24 ms
11,656 KB
testcase_04 AC 25 ms
11,768 KB
testcase_05 AC 25 ms
11,776 KB
testcase_06 AC 25 ms
11,716 KB
testcase_07 AC 26 ms
11,696 KB
testcase_08 AC 24 ms
11,648 KB
testcase_09 AC 24 ms
11,724 KB
testcase_10 AC 26 ms
11,812 KB
testcase_11 AC 24 ms
11,972 KB
testcase_12 AC 26 ms
11,696 KB
testcase_13 AC 25 ms
11,656 KB
testcase_14 AC 24 ms
11,740 KB
testcase_15 AC 24 ms
11,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
const int MAX = 2.1e6;
int dp[MAX];
signed main(){
  int n,k;
  cin>>n>>k;
  memset(dp,0,sizeof(dp));
  for(int i=2;i<MAX;i++)
    if(!dp[i]) for(int j=i;j<MAX;j+=i) dp[j]++;

  int ans=0;
  for(int i=2;i<=n;i++) ans+=dp[i]>=k;
  cout<<ans<<endl;
  return 0;
}
0