← All problemsSign in

SC and his recursion

SC really loves recurrence relations ( the mathematical kind ;) ). He has made his own new reccurence relation. The relation is given by: $F(N) = A*F(N-1) + N$. $F(0)$ is always equal to 1. You are given $T$ test cases, each test case has an input $A$ and $Q$. For each test case, you are given $Q$ queries, each query contains one number $q$. You have to find $F(q)$. Can you find that? Since the

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start