結果
問題 | No.2326 Factorial to the Power of Factorial to the... |
ユーザー |
|
提出日時 | 2023-05-28 14:55:47 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 63 ms / 2,000 ms |
コード長 | 419 bytes |
コンパイル時間 | 566 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-12-27 03:34:47 |
合計ジャッジ時間 | 2,235 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 |
ソースコード
import sysdef input():return sys.stdin.readline().rstrip()def main():N, P = map(int, input().split())mod = 10**9+7p = 1q = 1ans = 0for i in range(1, N+1):p *= ip %= modq *= iq %= (mod-1)a = iwhile not a%P:a //= Pans += 1p = pow(p, q, mod)print(p*ans%mod)if __name__ == "__main__":main()