結果
問題 | No.1659 Product of Divisors |
ユーザー |
👑 ![]() |
提出日時 | 2021-08-27 21:53:36 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,168 bytes |
コンパイル時間 | 3,625 ms |
コンパイル使用メモリ | 126,132 KB |
最終ジャッジ日時 | 2025-01-24 02:55:54 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 8 WA * 4 TLE * 11 |
ソースコード
#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(int n, int 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, K); } 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;