結果

問題 No.1659 Product of Divisors
ユーザー monnumonnu
提出日時 2021-08-28 00:54:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 838 bytes
コンパイル時間 3,410 ms
コンパイル使用メモリ 236,744 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-01 05:48:56
合計ジャッジ時間 4,263 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 6 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 8 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 3 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

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