結果
問題 | No.167 N^M mod 10 |
ユーザー |
|
提出日時 | 2015-05-29 00:18:09 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 531 bytes |
コンパイル時間 | 93 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-07-06 10:14:34 |
合計ジャッジ時間 | 1,572 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 2 |
other | RE * 27 |
ソースコード
N = int(input()[-1]) Mstr = input() M = int(M[-2:]) if Mstr == '0': print(1) elif N in (0, 1, 5, 6): print(N) elif N == 2: print([2, 4, 8, 6][(M-1) % 4]) elif N == 3: print([3, 9, 7, 1][(M-1) % 4]) elif N == 4: print([4, 6][(M-1) % 2]) elif N == 7: print([7, 9, 3, 1][(M-1) % 4]) elif N == 8: print([8, 4, 2, 6][(M-1) % 4]) elif N == 9: print([9, 1][(M-1) % 2]) # 0 -> 0 # 1 -> 1 # 2 -> 4 -> 8 -> 6 -> 2 # 3 -> 9 -> 7 -> 1 -> 3 # 4 -> 6 -> 4 # 5 -> 5 # 6 -> 6 # 7 -> 9 -> 3 -> 1 -> 7 # 8 -> 4 -> 2 -> 6 -> 8 # 9 -> 1 -> 9