結果

問題 No.167 N^M mod 10
コンテスト
ユーザー yaoshimax
提出日時 2015-03-19 23:32:10
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 76 ms / 1,000 ms
コード長 199 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 77,860 KB
最終ジャッジ日時 2025-12-03 14:26:52
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N=int(raw_input())
M=int(raw_input())
b=N%10
anslist=[b]
cur=(b*b)%10
while cur != b:
    anslist.append(cur)
    cur*=b
    cur%=10
if M==0:
    print 1
    exit()
print anslist[(M-1)%len(anslist)]
0