結果
| 問題 | No.251 大きな桁の復習問題(1) |
| コンテスト | |
| ユーザー |
👑 Kazun
|
| 提出日時 | 2026-02-01 23:08:20 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 49 ms / 5,000 ms |
| コード長 | 487 bytes |
| 記録 | |
| コンパイル時間 | 284 ms |
| コンパイル使用メモリ | 82,792 KB |
| 実行使用メモリ | 67,224 KB |
| 最終ジャッジ日時 | 2026-02-01 23:08:24 |
| 合計ジャッジ時間 | 3,078 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
def str_to_modint(S: str, M: int) -> int:
res = 0
for a in S:
res = (10 * res + int(a)) % M
return res
def solve():
Mod = 129402307
N_str = input()
M_str = input()
N_mod = str_to_modint(N_str, Mod)
M_mod = str_to_modint(M_str, Mod - 1)
if N_mod == 0:
if N_str == "0":
return 0
return 1 if M_str == "0" else 0
return pow(N_mod, M_mod, Mod)
#==================================================
print(solve())
Kazun