結果
| 問題 |
No.251 大きな桁の復習問題(1)
|
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2024-07-02 01:03:10 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 383 bytes |
| コンパイル時間 | 170 ms |
| コンパイル使用メモリ | 82,196 KB |
| 実行使用メモリ | 65,664 KB |
| 最終ジャッジ日時 | 2024-07-02 01:03:13 |
| 合計ジャッジ時間 | 2,319 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 WA * 2 |
ソースコード
# 巨大数の n^m % mod を求める (mod は素数)
def modpow(n: str, m: str, mod: int) -> int:
def modulo(s: str, m: int) -> int:
x = 0
for c in map(int, s):
x = (10*x + c) % m
return x
a = modulo(n, mod)
b = modulo(m, mod-1)
return pow(a, b, mod)
MOD = 129402307
N = input()
M = input()
ans = modpow(N, M, MOD)
print(ans)
norioc