Riya and Recurrences
CodeChefOpen on judge ↗
Riya loves recurrences very much so chef gives her a problem which is difficult to solve. $ G(n) = \begin{cases} 0 & \quad \text{if } n < 1\\ x & \quad \text{if } n = 1\\ y & \quad \text{if } n = 2\\ A*G(n-1) - B*G(n-2) & \quad \text{if } n \geq 3\\ \end{cases} $ $ F(n) = \begin{cases} G(n-k) + \displaystyle\sum_{i=1}^{k} \binom{n}{i} * G(i) & \quad \\ \end{cases
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start