結果
| 問題 | 
                            No.847 Divisors of Power
                             | 
                    
| コンテスト | |
| ユーザー | 
                             hipopo
                         | 
                    
| 提出日時 | 2020-01-19 19:44:57 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 5 ms / 2,000 ms | 
| コード長 | 1,190 bytes | 
| コンパイル時間 | 3,055 ms | 
| コンパイル使用メモリ | 201,300 KB | 
| 最終ジャッジ日時 | 2025-01-08 20:14:58 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 26 | 
ソースコード
/*#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>*/
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using ll = long long;
const long long MOD = 1e9+7;
map<int, int> prime_number_factor(int n) {
    map<int, int> res;
    for (int i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ++res[i];
            n /= i;
        }
    }
    if (n != 1) res[n] = 1;
    return res;
}
ll m;
vector<ll> p;
vector<ll> e;
int dfs(ll total, int ptr) {
    if ((int)p.size() <= ptr) return 1;
    int res = 0;
    for (int i = 0; i < e.at(ptr) + 1; i++) {
        if (m < total) break;
        res += dfs(total, ptr + 1);
        
        total *= p.at(ptr);
    }
    return res;
}
int main() { 
    ll n, k;
    cin >> n >> k >> m;
    auto ps = prime_number_factor(n);
    for (auto v: ps) {
        p.push_back(v.first);
        e.push_back(v.second * k);
    }
    
    cout << dfs(1, 0) << endl;
}   
            
            
            
        
            
hipopo