結果

問題 No.1659 Product of Divisors
ユーザー Sooh317Sooh317
提出日時 2021-08-27 21:54:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 3,473 bytes
コンパイル時間 1,886 ms
コンパイル使用メモリ 205,036 KB
実行使用メモリ 15,276 KB
最終ジャッジ日時 2024-05-01 02:24:43
合計ジャッジ時間 8,722 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
15,252 KB
testcase_01 AC 13 ms
15,220 KB
testcase_02 AC 13 ms
15,028 KB
testcase_03 AC 14 ms
15,276 KB
testcase_04 AC 21 ms
15,248 KB
testcase_05 AC 17 ms
15,076 KB
testcase_06 AC 15 ms
15,132 KB
testcase_07 AC 14 ms
15,092 KB
testcase_08 AC 23 ms
15,228 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 15 ms
15,036 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>
using namespace std;
//#include <atcoder/modint>
//using namespace atcoder;
//using mint = modint998244353;
//using mint = modint1000000007;
#pragma region template
using ll = long long;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define overload4(_1,_2,_3,_4,name,...) name
#define overload3(_1,_2,_3,name,...) name
#define rep1(n) for(ll i=0;i<n;++i)
#define rep2(i,n) for(ll i=0;i<n;++i)
#define rep3(i,a,b) for(ll i=a;i<b;++i)
#define rep(...) overload3(__VA_ARGS__,rep3,rep2,rep1)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define debug(var)  do{std::cerr << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cerr << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cerr << e << " "; } std::cerr << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){cerr << endl;int cnt = 0;for(const auto& v : vv){cerr << cnt << "th : "; view(v); cnt++;} cerr << endl;}
std::ostream &operator<<(std::ostream &dest, __int128_t value) {
  std::ostream::sentry s(dest);
  if (s) {
    __uint128_t tmp = value < 0 ? -value : value;
    char buffer[128];
    char *d = std::end(buffer);
    do {
      --d;
      *d = "0123456789"[tmp % 10];
      tmp /= 10;
    } while (tmp != 0);
    if (value < 0) {
      --d;
      *d = '-';
    }
    int len = std::end(buffer) - d;
    if (dest.rdbuf()->sputn(d, len) != len) {
      dest.setstate(std::ios_base::badbit);
    }
  }
  return dest;
}
ll power(ll a, ll p){ll ret = 1; while(p){if(p & 1){ret = ret * a;} a = a * a; p >>= 1;} return ret;}
ll modpow(ll a, ll p, ll mod){ll ret = 1; while(p){if(p & 1){ret = ret * a % mod;} a = a * a % mod; p >>= 1;} return ret;}
template<class T, class K>bool chmax(T &a, const K b) { if (a<b) { a=b; return 1; } return 0; }
template<class T, class K>bool chmin(T &a, const K b) { if (b<a) { a=b; return 1; } return 0; }
#pragma endregion
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
const int inf = 1001001001;
const ll INF = 1001001001001001001ll;
// const double pi = acos(-1);
//const ll mod = 998244353;
const ll mod = 1000000007;


const int MAX = 500000;

long long fact[MAX], finv[MAX], inv[MAX];

void Comb_init(){
    fact[0] = fact[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAX; i++){
        fact[i] = fact[i-1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod; 
    }
}

long long comb(long long n, long long k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fact[n] * finv[k] % mod * finv[n - k] % mod;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(20);
    Comb_init();
    ll n, k; cin >> n >> k;
    ll tmp = n;
    V<int> a;
    for(ll i = 2; i * i <= n; i++){
        if(tmp % i == 0){
            int cnt = 0;
            while(tmp % i == 0) cnt++, tmp /= i;
            a.pb(cnt);
        }
    }
    if(tmp != 1) a.pb(1);
    ll ans = 1;
    for(int v : a){
        ll tmp = 0;
        for(int i = 0; i <= v; i++){
            tmp += comb(i + k - 1, k - 1);
            if(tmp >= mod) tmp -= mod;
        }
        ans = (ans * tmp) % mod;
    }
    cout << ans << endl;
}  
0