結果

問題 No.847 Divisors of Power
ユーザー ninjaninja
提出日時 2019-07-05 21:56:48
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 751 bytes
コンパイル時間 1,899 ms
コンパイル使用メモリ 174,948 KB
実行使用メモリ 12,160 KB
最終ジャッジ日時 2024-04-16 07:16:56
合計ジャッジ時間 3,087 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 3 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 48 ms
10,240 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 3 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 15 ms
5,760 KB
testcase_22 AC 3 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 62 ms
12,160 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n, k, m;
  cin >> n >> k >> m;
  map<ll, ll> mp;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      mp[i]++;
      n /= i;
      i--;
    }
  }
  if (n > 1) mp[n]++;

  set<ll> s;
  s.insert(1);
  for (auto &v : mp) {
    set<ll> t;
    for (auto &i : s) {
      ll l = i;
      for (ll j = 0; j < v.second * k; j++) {
        l *= v.first;
        if (l > m) break;
        t.insert(l);
      }
    }

    for (auto &i : t) s.insert(i);
  }

  cout << s.size() << endl;
  return 0;
}
0