結果

問題 No.167 N^M mod 10
ユーザー 学ぶマン
提出日時 2025-03-04 13:30:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 50 ms / 1,000 ms
コード長 250 bytes
コンパイル時間 713 ms
コンパイル使用メモリ 82,344 KB
実行使用メモリ 54,380 KB
最終ジャッジ日時 2025-03-04 13:30:56
合計ジャッジ時間 3,151 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, math
sys.set_int_max_str_digits(0)
INF = 10**18
MOD = 998244353

N = input()
M = input()

if M == '0':
    exit(print(1))
if N[-1] == '0':
    exit(print(0))

N = int(N[-1])
M = int(M[-2:]) + 4
#print(N, M)
ans = pow(N, M, 10)
print(ans)
0