結果
問題 | No.2326 Factorial to the Power of Factorial to the... |
ユーザー |
|
提出日時 | 2023-05-28 15:04:37 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 20 ms / 2,000 ms |
コード長 | 460 bytes |
コンパイル時間 | 1,885 ms |
コンパイル使用メモリ | 195,640 KB |
最終ジャッジ日時 | 2025-02-13 12:30:08 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h>#include "atcoder/modint"using i64 = long long;using Fp = atcoder::modint1000000007;int main() {i64 N, P;std::cin >> N >> P;i64 base = 0;i64 q = 1;while (q <= N) {q *= P;base += N / q;}Fp u = 1;for (int i = 1; i <= N; ++i) u *= i;i64 x = 1;for (int i = 1; i <= N; ++i) x = (x * i) % 1000000006;u = u.pow(x);std::cout << (base * u).val() << std::endl;}