結果

問題 No.167 N^M mod 10
ユーザー tookunn_1213
提出日時 2015-08-14 14:00:11
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 169 bytes
コンパイル時間 43 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2024-07-18 09:22:06
合計ジャッジ時間 1,134 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = input(),input()
n = N % 10
li = []
now = n
while True:
	if now in li:break
	li.append(now)
	now *= n
	now %= 10
print li[(M - 1 if M - 1 >= 0 else M + 1)% len(li)]
0