結果

問題 No.106 素数が嫌い!2
ユーザー granddaifukugranddaifuku
提出日時 2020-03-20 01:30:30
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 895 bytes
コンパイル時間 1,599 ms
コンパイル使用メモリ 168,548 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-20 21:19:21
合計ジャッジ時間 37,197 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,040 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2,036 ms
4,376 KB
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 AC 131 ms
4,380 KB
testcase_09 AC 143 ms
4,376 KB
testcase_10 TLE -
testcase_11 AC 1,712 ms
4,376 KB
testcase_12 TLE -
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;
typedef long double ld;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

vector<pair<ll, int> > prime_factorize(ll n) {
  vector<pair<ll, int> > res;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i) continue;
    res.push_back(make_pair(i, 0));
    while (n % i == 0) {
      n /= i;
      res.back().second++;
    }
  }
  if (n != 1) res.push_back(make_pair(n, 1));
  return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int n, k, res = 0;
    cin >> n >> k;
    FOR (i, 2, n + 1) {
        auto v = prime_factorize(i);
        if (v.size() >= k) res++;
    } 
    cout << res << endl;
    
    return 0;
}
0