結果

問題 No.1659 Product of Divisors
ユーザー monnu
提出日時 2021-08-28 00:54:34
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 10 ms / 2,000 ms
コード長 838 bytes
コンパイル時間 3,776 ms
コンパイル使用メモリ 235,288 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-21 07:25:41
合計ジャッジ時間 4,644 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll=long long;
using Graph=vector<vector<int>>;
#define MAX 2000000
#define MOD 1000000007
#define INF 1000000000

ll modpow(ll a,ll n){
  a%=MOD;
  ll ret=1;
  while(n>0){
    if((n&1)==1){
      ret=ret*a%MOD;
    }
    n>>=1;
    a=a*a%MOD;
  }
  return ret;
}

ll modinv(ll x){
  return modpow(x,MOD-2);
}

int main(){
  ll N,K;
  cin>>N>>K;
  map<ll,int> m;
  for(ll i=2;i*i<=N;i++){
    while(N%i==0){
      m[i]++;
      N/=i;
    }
  }
  if(N>1){
    m[N]++;
  }
  ll ans=1;
  for(auto p:m){
    ll sum=0;
    ll x=1;
    sum+=1;
    for(int i=1;i<=p.second;i++){
      x*=(K-1+(ll)i)%MOD;
      x%=MOD;
      x*=modinv((ll)i);
      x%=MOD;
      sum+=x;
      sum%=MOD;
    }
    ans*=sum;
    ans%=MOD;
  }
  cout<<ans<<'\n';
}
0