結果
| 問題 | 
                            No.106 素数が嫌い!2
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2015-01-16 15:43:33 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,761 bytes | 
| コンパイル時間 | 1,896 ms | 
| コンパイル使用メモリ | 159,440 KB | 
| 実行使用メモリ | 18,752 KB | 
| 最終ジャッジ日時 | 2024-06-22 12:02:46 | 
| 合計ジャッジ時間 | 14,225 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | -- * 3 | 
| other | TLE * 1 -- * 12 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)):((m)-(n))),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)
#define loop for(;;)
#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;
typedef long long Integer;
typedef double Real;
typedef vector<int> vi;
typedef vector<string> vs;
typedef map<string,int> Dictionary;
const Real PI = acos(-1);
typedef pair<Real, Real> P; // Point
typedef pair<P, P> L; // segment or line
template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}
template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  if (v.size() == 0) {
    os << "(empty)";
    return os;
  }
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}
bool* PrimeSieve(int n) {
  bool*s = new bool[n];
  for (int i = 0; i < n; ++i) s[i] = true;
  s[0] = s[1] = false;
  for (int i = 2; i < n; ++i)
    if (s[i]) for (int j = i << 1; j < n; j += i) s[j] = false;
  return s;
}
int main(){
  auto ps = PrimeSieve(2e6+10);
  int n, k; cin >> n >> k;
  int ans = 0;
  range (m, 2, n + 1) {
    int cx = 0;
    int x = m;
    int idx = 0;
    while (x > 1) {
      while (!ps[idx]) ++idx;
      bool bl = false;
      while (x % idx == 0) {
        x /= idx;
        bl = true;
      }
      if (bl) ++cx;
      ++idx;
    }
    if (cx >= k) ++ans;
  }
  cout << ans << endl;
  return 0;
}