結果
問題 | No.1659 Product of Divisors |
ユーザー | nawawan |
提出日時 | 2021-08-27 22:35:13 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,454 bytes |
コンパイル時間 | 2,103 ms |
コンパイル使用メモリ | 212,860 KB |
実行使用メモリ | 13,136 KB |
最終ジャッジ日時 | 2024-11-21 03:37:45 |
合計ジャッジ時間 | 3,033 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 5 ms
13,008 KB |
testcase_01 | AC | 5 ms
13,004 KB |
testcase_02 | AC | 6 ms
12,992 KB |
testcase_03 | AC | 5 ms
12,948 KB |
testcase_04 | WA | - |
testcase_05 | AC | 4 ms
13,004 KB |
testcase_06 | WA | - |
testcase_07 | AC | 6 ms
13,008 KB |
testcase_08 | AC | 4 ms
13,132 KB |
testcase_09 | WA | - |
testcase_10 | AC | 12 ms
12,940 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 4 ms
12,996 KB |
testcase_14 | WA | - |
testcase_15 | AC | 5 ms
12,988 KB |
testcase_16 | AC | 5 ms
13,004 KB |
testcase_17 | AC | 4 ms
13,004 KB |
testcase_18 | AC | 6 ms
12,956 KB |
testcase_19 | AC | 5 ms
13,000 KB |
testcase_20 | AC | 5 ms
13,004 KB |
testcase_21 | AC | 6 ms
13,004 KB |
testcase_22 | AC | 14 ms
13,056 KB |
testcase_23 | AC | 4 ms
13,132 KB |
testcase_24 | AC | 6 ms
13,004 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; template<const int MOD> struct modint{ long long val; modint(): val(0) {} modint(long long x){ if(x < 0) val = x % MOD + MOD; else val = x % MOD; } modint(const modint &t){ val = t.val; } modint& operator =(const modint m){ val = m.val; return *this; } modint operator -(){ return modint(-val); } modint& operator-=(const modint &m){ val -= m.val; if(val < 0) val += MOD; return *this; } modint& operator+=(const modint &m){ val += m.val; if(val >= MOD) val -= MOD; return *this; } modint& operator*=(const modint &m){ val *= m.val; val %= MOD; return *this; } modint& operator/=(modint m){ *this *= m.inv(); return *this; } modint inv(){ long long x = 1, y = 0; long long a = val, b = MOD; while(b != 0){ long long t = a / b; a -= t * b; x -= t * y; swap(a, b); swap(x, y); } x %= MOD; if(x < 0) x += MOD; return modint(x); } modint pow(long long k){ long long res = 1; long long v = val; while(k > 0){ if(k & 1) res = res * v % MOD; v = v * v % MOD; k >>= 1; } return modint(res); } bool operator==(const modint &m){ return val == m.val; } modint operator+(const modint &m){ return modint(*this) += m; } modint operator-(const modint &m){ return modint(*this) -= m; } modint operator*(const modint &m){ return modint(*this) *= m; } modint operator/(const modint &m){ return modint(*this) /= m; } bool operator!=(const modint &m){ return modint(*this).val != m.val; } bool operator!=(const int &m){ return modint(*this).val != m; } }; const int MOD = 1000000007; using mint = modint<MOD>; const int MAX = 410000; mint fac[MAX], finv[MAX], inv[MAX]; void COMinit(){ fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for(int i = 2; i < MAX; i++){ fac[i] = fac[i - 1] * i; inv[i] = mint(MOD) - inv[MOD % i] * (MOD / i); finv[i] = finv[i - 1] * inv[i]; } } mint COM(int n, int k){ if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * finv[k] * finv[n - k]; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); long long N, K; cin >> N >> K; map<long long, int> m; long long t = N; for(long long i = 2; i * i <= t; i++){ while(t % i == 0){ m[i]++; t /= i; } } if(t > 1) m[t]++; vector<mint> temp(61); vector<mint> inv(61); mint iv = 1; for(int i = 1; i < 61; i++) iv *= i; iv = iv.inv(); inv[60] = iv; for(int i = 60; i > 1; i--) { inv[i - 1] = inv[i] * i; } mint T = K; for(int i = 1; i < 61; i++){ temp[i] = T * inv[i]; T *= (K - i) % MOD; } mint ans = 1; for(auto [a, b] : m){ mint tmp = 0; for(int i = 1; i <= b; i++) { for(int j = 1; j <= i; j++){ if(j > K) continue; else tmp += temp[j]; } } tmp += 1; ans *= tmp; } cout << ans.val << endl; }