結果

問題 No.167 N^M mod 10
コンテスト
ユーザー bellangeldindon
提出日時 2019-05-10 16:34:34
言語 PyPy2
(7.3.15)
結果
RE  
実行時間 -
コード長 243 bytes
記録
コンパイル時間 249 ms
コンパイル使用メモリ 77,364 KB
最終ジャッジ日時 2025-12-04 01:44:09
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25 RE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

modlist = [[], [1], [2, 4, 8, 6], [3, 9, 7, 1], [4, 6], [5], [6], [7, 9, 3, 1], [8, 4, 2, 6], [9, 1]]

N = int(raw_input())
M = int(raw_input())

ans = 1
if M != 0:
	n = int(str(N)[-1])
	m = M - 1
	ans = modlist[n][m%len(modlist[n])]
print ans
0