結果
| 問題 |
No.1595 The Final Digit
|
| ユーザー |
|
| 提出日時 | 2021-07-09 22:00:34 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 382 bytes |
| コンパイル時間 | 187 ms |
| コンパイル使用メモリ | 82,404 KB |
| 実行使用メモリ | 67,084 KB |
| 最終ジャッジ日時 | 2024-07-01 16:22:40 |
| 合計ジャッジ時間 | 2,393 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 WA * 6 RE * 3 |
ソースコード
p, q, r, k = map(int,input().split())
a = [0] * 100
a[0] = p % 10
a[1] = q % 10
a[2] = r % 10
for i in range(3, 100):
x = (a[i - 1] + a[i - 2] + a[i - 3]) % 10
if x in a[4:]:
start = a.index(x)
end = i
a[i] = x
break
a[i] = x
if k <= end:
print(a[k - 1])
exit()
ind = (k - start) % (end - start) + start - 1
print(a[ind])