結果
| 問題 |
No.2326 Factorial to the Power of Factorial to the...
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-28 15:00:23 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 392 bytes |
| コンパイル時間 | 2,006 ms |
| コンパイル使用メモリ | 194,356 KB |
| 最終ジャッジ日時 | 2025-02-13 12:22:46 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 WA * 9 |
ソースコード
#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;
u = u.pow(u.val());
std::cout << (base * u).val() << std::endl;
}