結果

問題 No.167 N^M mod 10
ユーザー yomo3
提出日時 2020-03-07 01:08:43
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 1,000 ms
コード長 355 bytes
コンパイル時間 124 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-10-14 11:00:17
合計ジャッジ時間 1,947 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

SN = input()
SM = input()

N = int(SN[-1])
r = [
        [0, 0, 0, 0],
        [1, 1, 1, 1],
        [6, 2, 4, 8],
        [1, 3, 9, 7],
        [6, 4, 6, 4],
        [5, 5, 5, 5],
        [6, 6, 6, 6],
        [1, 7, 9, 3],
        [6, 8, 4, 2],
        [1, 9, 1, 9]
]
if SM == '0':
    ans = 1
else:
    x = int(SM[-2:])
    ans = r[N][x%4]
print(ans) 
0