Magic Numbers
CodeChefOpen on judge ↗
Chef has challenged you in the game of Magic Numbers. Chef gives you a set of numbers forming a pattern, your job is to give chef the Magic Number he wants. Here is a pattern: an = b1 an-3 + b2 an-2 + b3 an-1 Given b1, b2, b3, a0, a1, a2 and k find ak modulo 10^9+7. Input First line is an integer T denoting the number of test cases. For each test case, there are 6 space separated integers
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