結果
問題 |
No.2326 Factorial to the Power of Factorial to the...
|
ユーザー |
![]() |
提出日時 | 2023-05-28 16:03:14 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,006 bytes |
コンパイル時間 | 4,613 ms |
コンパイル使用メモリ | 192,084 KB |
最終ジャッジ日時 | 2025-02-13 15:04:49 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 5 WA * 2 TLE * 13 |
ソースコード
#include <bits/stdc++.h> #include <numeric> // #include <atcoder/modint> using namespace std; // using namespace atcoder; // using mint = modint998244353; #define i64 int_fast64_t const i64 INF = INT64_MAX; const i64 ERR = INT64_MIN; const i64 MOD = 1000000007; // 切り上げ i64 ceil_devide(i64 x, i64 y) { return (x + y - 1) / y; } // 切り捨て i64 floor_devide(i64 x, i64 y) { return x / y; } i64 sum_linear(i64 n) { return n * (n+1) / 2; } int main() { i64 n,p; cin >> n >> p; i64 p_num = 0; i64 res = 0; i64 po = 1; for (size_t i = 1; true; i++) { po *= p; i64 add = n / po; if (add < 1) { break; } res += n / po; } i64 kaizyou = 1; for (size_t i = 1; i <= n; i++) { kaizyou *= i; kaizyou %= MOD; } for (size_t i = 0; i < kaizyou; i++) { res *= kaizyou; res %= MOD; } cout << res << endl; return 0; }