結果

問題 No.1659 Product of Divisors
ユーザー carrot46carrot46
提出日時 2021-08-27 23:19:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 2,056 bytes
コンパイル時間 2,481 ms
コンパイル使用メモリ 206,748 KB
実行使用メモリ 50,260 KB
最終ジャッジ日時 2024-05-01 04:14:51
合計ジャッジ時間 13,755 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
49,996 KB
testcase_01 AC 53 ms
50,152 KB
testcase_02 AC 53 ms
49,932 KB
testcase_03 AC 55 ms
49,932 KB
testcase_04 AC 55 ms
50,112 KB
testcase_05 AC 55 ms
49,932 KB
testcase_06 AC 56 ms
50,168 KB
testcase_07 AC 56 ms
50,152 KB
testcase_08 AC 55 ms
50,260 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 57 ms
50,112 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using namespace atcoder;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()

using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

ll N,M,H,W,Q,K,A,B;
string S;
using P = pair<ll, ll>;
using tp = tuple<ll, ll, ll>;
const ll INF = (1LL<<60);

template<class T> bool chmin(T &a, const T b){
    if(a > b) {a = b; return true;}
    else return false;
}
template<class T> bool chmax(T &a, const T b){
    if(a < b) {a = b; return true;}
    else return false;
}
template<class T> void my_printv(std::vector<T> v,bool endline = true){
    if(!v.empty()){
        for(std::size_t i{}; i<v.size()-1; ++i) std::cout<<v[i]<<" ";
        std::cout<<v.back();
    }
    if(endline) std::cout<<std::endl;
}

using mint = modint1000000007 ;
using vm = vector<mint>;

const ll MAX_N = ll(4e+6) + 10;
vm fact(MAX_N, mint(1)), fact_inv(MAX_N, mint(1)), n_inv(MAX_N, mint(1));
void makefact(){
    mint tmp;
    reps(i,2,MAX_N) fact[i] = fact[i-1] * mint::raw(i);
    fact_inv[MAX_N - 1] = fact[MAX_N - 1].inv();
    Rreps(i, MAX_N - 1, 1){
        fact_inv[i] = fact_inv[i + 1] * mint::raw(i + 1);
        n_inv[i + 1] = fact[i] * fact_inv[i + 1];
    }
}
mint nCm(ll n, ll m){
    return fact[n] * fact_inv[n-m] * fact_inv[m];
}
mint nCm_inv(ll n, ll m){
    return fact[n-m] * fact[m] * fact_inv[n];
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    makefact();
    cin>>N>>K;
    mint res(1);
    auto calc = [&](int k){
        mint sum(0);
        rep(i, k + 1) {
            sum += nCm(K + i - 1, i);
        }
        res *= sum;
    };
    for(ll i = 2; i * i <= N; ++i){
        if(N % i == 0){
            int num = 0;
            while(N % i == 0) {
                ++num;
                N /= i;
            }
            calc(num);
        }
    }
    if(N != 1) calc(1);
    cout<<res.val()<<endl;
}
0