結果

問題 No.2326 Factorial to the Power of Factorial to the...
ユーザー CyanmondCyanmond
提出日時 2023-05-28 15:00:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 392 bytes
コンパイル時間 1,991 ms
コンパイル使用メモリ 201,256 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-08-27 11:06:46
合計ジャッジ時間 2,866 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 WA -
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 WA -
testcase_14 AC 2 ms
4,380 KB
testcase_15 WA -
testcase_16 AC 2 ms
4,376 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0