X Sequence
CodeChefOpen on judge ↗
Once again, Vicky is back in the Kingdom of ByteLand. The people of Byteland are very inquisitive about number sequences and Vicky is pondering over a sequence which they called as an X-Sequence .This sequence is described as follows: The sequence is made of integers: a1, a2, a3, a4...aN where , 1) |ak - a(k+1)| = X 2) a1 = 0 3) S = a1 + a2 + a3 + .... + aN Here , X and N are positive 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