結果
| 問題 |
No.1659 Product of Divisors
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-08-27 22:32:15 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 886 bytes |
| コンパイル時間 | 1,617 ms |
| コンパイル使用メモリ | 174,984 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-21 03:33:35 |
| 合計ジャッジ時間 | 2,561 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 15 WA * 8 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, l, r) for (ll i = (l); i < (r); i++)
using namespace std;
typedef long long ll;
ll mod_pow(ll x, ll n, ll mod) {
ll res = 1;
while (n > 0) {
if (n & 1) res = res * x % mod;
x = x * x % mod;
n >>= 1;
}
return res;
}
int main() {
ll N, K;
cin >> N >> K;
map<ll, int> mp;
for (ll i = 2; i * i <= N; i++) {
while (N % i == 0) {
mp[i]++;
N /= i;
//cout << N << " " << i << " " << mp[i] << endl;
}
}
if (N > 1) mp[N]++;
ll ans = 1, MOD = 1e9 + 7;
for (auto i : mp) {
//cout << i.first << " " << i.second << endl;
ll y = i.second, x = K + y;
rep(j, 0, y) {
ans = (ans * (x - j)) % MOD;
ans = (ans * mod_pow(j + 1, MOD - 2, MOD)) % MOD;
}
}
cout << ans << endl;
}