結果
問題 |
No.1659 Product of Divisors
|
ユーザー |
|
提出日時 | 2021-08-27 22:21:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 888 bytes |
コンパイル時間 | 1,704 ms |
コンパイル使用メモリ | 173,932 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-21 03:18:59 |
合計ジャッジ時間 | 2,573 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 15 WA * 8 |
ソースコード
#include <bits/stdc++.h> #define rep(i, l, r) for (int 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<int, 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; }