結果
問題 |
No.167 N^M mod 10
|
ユーザー |
|
提出日時 | 2025-04-21 23:46:43 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 239 bytes |
コンパイル時間 | 550 ms |
コンパイル使用メモリ | 82,948 KB |
実行使用メモリ | 67,220 KB |
最終ジャッジ日時 | 2025-04-21 23:46:46 |
合計ジャッジ時間 | 3,372 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 17 RE * 10 |
ソースコード
N = int(input()) M = int(input()) if M == 0: print(1) exit() val = N%10 m = 0 arr = [] while val not in arr and m < M: arr.append(val) val *= N val %= 10 m += 1 period = len(arr) q, mod = divmod(M, period) print(arr[mod-1])