結果
| 問題 |
No.167 N^M mod 10
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-16 23:00:53 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 234 bytes |
| コンパイル時間 | 340 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 52,352 KB |
| 最終ジャッジ日時 | 2024-11-08 18:51:54 |
| 合計ジャッジ時間 | 2,763 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 WA * 3 |
ソースコード
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
else:
M = int(M)
if N % 2 == 0:
print((ans2 * N ** M) % 10)
else:
print((N ** M) % 10)