結果
| 問題 | 
                            No.1659 Product of Divisors
                             | 
                    
| コンテスト | |
| ユーザー | 
                             srjywrdnprkt
                         | 
                    
| 提出日時 | 2023-06-07 23:25:45 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,230 bytes | 
| コンパイル時間 | 962 ms | 
| コンパイル使用メモリ | 111,960 KB | 
| 最終ジャッジ日時 | 2025-02-13 23:18:07 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 18 WA * 5 | 
ソースコード
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
using namespace std;
using ll = long long;
const ll modc=1e9+7, MAX=1000000;
vector<ll> f, finv;
ll inv(ll x){
    ll ans = 1, e = modc-2;
    x %= modc;
    while (e > 0){
        if ((e & 1LL)) ans = (ans * x) % modc;
        e = e >> 1LL;
        x = (x*x) % modc;
    }
    return ans;
}
ll C(ll n, ll k){
    ll ans=1;
 
    for(ll i = 0; i<k; i++) ans = ans * (n-i) % modc;
    for(ll i=1; i<=k; i++) ans = (ans*inv(i)) % modc;
 
    return ans;
}
map<ll, ll> prime;
void prime_factor(ll n){
    ll m = n;
    if (n % 2 == 0){
        while(n % 2 == 0){
            prime[2]++;
            n /= 2;
        }
    }
    for (ll i = 3; i*i <= m; i+=2){
        if (n % i == 0){
            while(n % i == 0){
                prime[i]++;
                n /= i;
            }
        }
    }
    if (n != 1){
        prime[n]++;
    }
}
int main(){
    ll N, K, ans=1;
    cin >> N >> K;
    prime_factor(N);
    for (auto [x, y] : prime){
        ans *= C(K+y, y);
        ans %= modc;
    }
    cout << ans << endl;
    return 0;
}
            
            
            
        
            
srjywrdnprkt