結果

問題 No.847 Divisors of Power
ユーザー m-44m-44
提出日時 2019-09-08 16:09:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 700 bytes
コンパイル時間 1,647 ms
コンパイル使用メモリ 174,764 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-09 22:31:56
合計ジャッジ時間 6,672 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 4 ms
4,376 KB
testcase_08 AC 435 ms
4,380 KB
testcase_09 AC 5 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 3 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 3 ms
4,380 KB
testcase_16 AC 19 ms
4,376 KB
testcase_17 AC 8 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 646 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 3 ms
4,376 KB
testcase_25 WA -
testcase_26 AC 1 ms
4,376 KB
testcase_27 TLE -
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int n, k, m;
long long calc(vector<pair<int, int> > &v, int i, long val) {
  if (i == v.size()) {
    return 1;
  }
  int d = v[i].first;
  int cnt = v[i].second;
  long tmp = 1;
  long long ret = 0;
  for (int j=0; j<=cnt; j++) {
    ret += calc(v, i+1, val*tmp);
    tmp *= d;
    if (tmp * val > m) {
      break;
    }
  }
  return ret;
}
int main() {
  cin>>n>>k>>m;
  map<int, int> d;
  for (int i=2; i<=n; i++) {
    if (n % i != 0) {
      continue;
    }
    while (n % i == 0) {
      ++d[i];
      n /= i;
    }
  }
  for (auto di: d) {
    d[di.first] *= k;
  }
  vector<pair<int, int> > v(d.begin(), d.end());
  cout<<calc(v, 0, 1)<<endl;
}
0