結果

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

ソースコード

diff #

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

if N % 2 == 0:
    print((ans2 * N ** M) % 10)
else:
    print((N ** M) % 10)
0