No.1595 The Final Digit
レベル :
/ AI推定難易度 : 800
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 299
作問者 :
e869120
/ テスター :
hirakich1000000007
ygussany
タグ : / 解いたユーザー数 299
作問者 :
e869120
/ テスター :
問題文最終更新日: 2021-07-08 23:25:30
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
競プロ典型 90 問 期末試験
(順位表)
の他の問題:
Problem Statement
Consider the sequence $A = (A_1, A_2, A_3, \dots, A_K)$ defined as follows.
- $A_1 = p, A_2 = q, A_3 = r$.
- For $N \geq 4$, $A_N = A_{N-1} + A_{N-2} + A_{N-3}$.
Input
$p$ $q$ $r$ $K$
Output
Output the answer.
Constraints
- $1 \leq p \leq 10^9$
- $1 \leq q \leq 10^9$
- $1 \leq r \leq 10^9$
- $4 \leq K \leq 10^{18}$
- All inputs are integers.
Sample
Sample 1
Input
11 11 11 7
Output
7
Since $A_7 = 187$, printing $7$ is correct.
Sample 2
Input
86 91 20 1001
Output
8
Sample 3
Input
31415 92653 58979 1000000000000000000
Output
5
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。