結果
問題 |
No.251 大きな桁の復習問題(1)
|
ユーザー |
![]() |
提出日時 | 2024-07-02 11:12:00 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 73 ms / 5,000 ms |
コード長 | 299 bytes |
コンパイル時間 | 578 ms |
コンパイル使用メモリ | 82,528 KB |
実行使用メモリ | 68,480 KB |
最終ジャッジ日時 | 2024-07-02 11:12:03 |
合計ジャッジ時間 | 2,790 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
def modulo(s: str, m: int) -> int: x = 0 for c in map(int, s): x = (10*x + c) % m return x MOD = 129402307 N = input() M = input() ans = 1 a = modulo(N, MOD) for d in reversed([int(c) for c in M]): ans *= pow(a, d, MOD) ans %= MOD a = pow(a, 10, MOD) print(ans)