結果
問題 | No.167 N^M mod 10 |
ユーザー |
![]() |
提出日時 | 2017-05-23 18:12:38 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 13 ms / 1,000 ms |
コード長 | 211 bytes |
コンパイル時間 | 445 ms |
コンパイル使用メモリ | 6,812 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-22 01:42:20 |
合計ジャッジ時間 | 1,670 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 27 |
ソースコード
n = int(raw_input()) % 10m = int(raw_input())l = [n]while len(l) < 2 or l[0] != l[len(l)-1]:l.append((n * l[len(l)-1]) % 10)ll = l[0:-1]s = len(ll)if m == 0:print 1else:print ll[(m % s)-1]