結果

問題 No.251 大きな桁の復習問題(1)
コンテスト
ユーザー tktk_snsn
提出日時 2020-12-14 20:42:48
言語 Python3
(3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ac-library)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 116 ms / 5,000 ms
+ 387µs
コード長 307 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 275 ms
コンパイル使用メモリ 21,468 KB
実行使用メモリ 15,660 KB
最終ジャッジ日時 2026-08-31 11:24:27
合計ジャッジ時間 4,170 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

mod = 129402307


def calc_mod(n, mod):
    res = 0
    for s in n:
        res *= 10
        res += int(s)
        res %= mod
    return res


N = input()
M = input()
if M == "0":
    print(1)
    exit()

N = calc_mod(N, mod)
M = calc_mod(M, mod - 1)
if N == 0:
    print(0)
else:
    print(pow(N, M, mod))
0