結果

問題 No.167 N^M mod 10
ユーザー gorugo30
提出日時 2021-03-16 23:01:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 269 bytes
コンパイル時間 415 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 52,224 KB
最終ジャッジ日時 2024-11-08 18:52:10
合計ジャッジ時間 2,631 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 26 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input()[-1])
M = input()
if M == "0":
    print(1)
    exit()
if N == 0:
    print(0)
    exit()
ans2 = 1
if len(M) > 2:
    M = int(M[len(M) - 2:])
    ans2 = 6
else:
    M = int(M)
if N % 2 == 0:
    print((ans2 * N ** M) % 10)
else:
    print((N ** M) % 10)
0