結果
| 問題 | No.1659 Product of Divisors |
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2021-08-27 21:56:17 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 7 ms / 2,000 ms |
| コード長 | 1,175 bytes |
| コンパイル時間 | 3,008 ms |
| コンパイル使用メモリ | 127,256 KB |
| 最終ジャッジ日時 | 2025-01-24 02:58:46 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <atcoder/modint>
using namespace std;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
#define rep(i,n) for(int i=0; i<(n); i++)
vector<pair<u64,u64>> factorize(u64 N){
vector<pair<u64,u64>> res;
for(u64 i=2; i*i<=N; i++){
if(N%i) continue;
res.push_back({i,0});
while(N%i==0){ N/=i; res.back().second++; }
}
if(N!=1) res.push_back({N,1});
return move(res);
}
vector<u64> divs(vector<pair<u64,u64>> F){
vector<u64> res = {1};
for(auto f:F){
int t=res.size() * f.second;
rep(i,t) res.push_back(res[i] * f.first);
}
return move(res);
}
using m32 = atcoder::static_modint<1000000007>;
m32 Comb(i64 n, i64 r){
m32 ans = 1;
rep(i,r) ans /= (i+1);
rep(i,r) ans *= n-i;
return ans;
}
int main(){
u64 N,K; cin >> N >> K;
auto F = factorize(N);
m32 ans = 1;
for(auto f : F){
ans *= Comb(f.second + K, f.second);
}
cout << ans.val() << endl;
return 0;
}
struct ios_do_not_sync{
ios_do_not_sync(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
}
} ios_do_not_sync_instance;
Nachia