結果
問題 | No.167 N^M mod 10 |
ユーザー |
|
提出日時 | 2021-03-16 23:02:54 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 42 ms / 1,000 ms |
コード長 | 321 bytes |
コンパイル時間 | 437 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 52,224 KB |
最終ジャッジ日時 | 2024-11-08 18:54:29 |
合計ジャッジ時間 | 2,506 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 27 |
ソースコード
N = int(input()[-1])M = input()if N == 5 and M[-1] == "0":print(5)exit()if M == "0":print(1)exit()if N == 0:print(0)exit()ans2 = 1if len(M) > 2:M = int(M[len(M) - 2:])ans2 = 6else:M = int(M)if N % 2 == 0:print((ans2 * N ** M) % 10)else:print((N ** M) % 10)