結果

問題 No.167 N^M mod 10
ユーザー bellangeldindon
提出日時 2019-05-10 16:38:55
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 289 bytes
コンパイル時間 111 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2024-07-02 01:00:25
合計ジャッジ時間 1,278 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23 WA * 1 RE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

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 = raw_input()
M = raw_input()

ans = 1
if M != 0:
	n = int(N[-1])
	m = 0
	if len(M) > 2: m = int(M[-3]+M[-2]+M[-1])-1
	else: m = int(M)-1
	ans = modlist[n][m%len(modlist[n])]
print ans
0