結果
| 問題 | No.1595 The Final Digit | 
| コンテスト | |
| ユーザー |  convexineq | 
| 提出日時 | 2021-07-09 21:54:43 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 43 ms / 2,000 ms | 
| コード長 | 198 bytes | 
| コンパイル時間 | 166 ms | 
| コンパイル使用メモリ | 82,176 KB | 
| 実行使用メモリ | 52,224 KB | 
| 最終ジャッジ日時 | 2024-07-01 16:12:30 | 
| 合計ジャッジ時間 | 1,771 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 17 | 
ソースコード
p,q,r,K = map(int,input().split())
dp = [p%10,q%10,r%10]
while True:
    dp.append(sum(dp[-3:])%10)
    if dp[:3] == dp[-3:]:
        break
for _ in range(3): dp.pop()
L = len(dp)
print(dp[(K-1)%L])
            
            
            
        