結果
| 問題 | No.847 Divisors of Power |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-10-02 18:34:21 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,033 bytes |
| 記録 | |
| コンパイル時間 | 1,231 ms |
| コンパイル使用メモリ | 214,640 KB |
| 実行使用メモリ | 7,968 KB |
| 最終ジャッジ日時 | 2026-06-27 21:03:33 |
| 合計ジャッジ時間 | 2,644 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
vector<pair<long long, long long>> prime_factorize(long long N){
vector<pair<long long, long long>> res;
for(long long a = 2; a * a <= N; ++a){
if(N % a != 0) continue;
long long ex = 0;
while(N % a == 0) ++ex, N /= a;
res.push_back({a,ex});
}
if(N != 1) res.push_back({N,1});
return res;
}
int main(){
cin.tie(0);
ios::sync_with_stdio(0);
// max: 2,3,5,7,11,13,17,19,23
ll N,K,M; cin >> N >> K >> M;
auto pf = prime_factorize(N);
int ans = 0;
function<void(int,ll)> dfs = [&](int i, ll x) -> void {
if(i == int(pf.size())) {
if(x <= M) ans++;
} else {
auto [p, e] = pf[i];
int cnt = 0;
do {
dfs(i + 1, x);
x *= p;
cnt++;
} while(x <= M && cnt <= e * K);
}
}; dfs(0, 1LL);
cout << ans << endl;
}