結果
問題 | No.2326 Factorial to the Power of Factorial to the... |
ユーザー |
![]() |
提出日時 | 2023-05-28 13:40:46 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 41 ms / 2,000 ms |
コード長 | 242 bytes |
コンパイル時間 | 337 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 58,112 KB |
最終ジャッジ日時 | 2024-12-26 21:27:25 |
合計ジャッジ時間 | 1,912 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 |
ソースコード
mod=10**9+7 N,P=map(int,input().split()) if N<P: print(0) else: C=0 p=P while p<=N: C+=N//p p*=P V=1 W=1 for i in range(1,N+1): V=V*i%mod W=W*i%(mod-1) print(C*pow(V,W,mod)%mod)