結果
| 問題 |
No.167 N^M mod 10
|
| コンテスト | |
| ユーザー |
steek79
|
| 提出日時 | 2015-10-21 20:42:29 |
| 言語 | Python2 (2.7.18) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 389 bytes |
| コンパイル時間 | 556 ms |
| コンパイル使用メモリ | 6,912 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2024-07-22 11:23:42 |
| 合計ジャッジ時間 | 1,874 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 25 WA * 2 |
ソースコード
N = input()
M = input()
N = N%10
if N == 1:
ans = 1
elif N == 2:
ans = [2, 4, 8, 6][M%4-1]
elif N == 3:
ans = [3, 9, 7, 1][M%4-1]
elif N == 4:
ans = [4, 6][M%2-1]
elif N == 5:
ans = 5
elif N == 6:
ans = 6
elif N == 7:
ans = [7, 9, 3, 1][M%4-1]
elif N == 8:
ans = [8, 4, 2, 6][M%4-1]
elif N == 9:
ans = [9, 1][M%2-1]
elif N == 0:
ans = 0
print ans
steek79