結果
問題 | No.1595 The Final Digit |
ユーザー |
|
提出日時 | 2021-07-09 21:42:39 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 32 ms / 2,000 ms |
コード長 | 358 bytes |
コンパイル時間 | 80 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-07-01 15:40:12 |
合計ジャッジ時間 | 1,437 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
p,q,r,K = [int(i) for i in input().split()]p%=10q%=10r%=10arr = [p,q,r]rep = {}for i in range(4, K+1):t = sum(arr[-3:])t %= 10arr.append(t)tup = tuple(arr[-4:])if tup in rep:# print(tup)arr = arr[rep[tup]-4:-4]breakrep[tup] = i# print((K-1) % len(arr))print(arr[(K-1) % len(arr)])# print(arr)