Sequence
CodeChefOpen on judge ↗
Problem description. You are given a number g. Find a sequence S of length n which satisfies the following condition: 1)GCD ( S0, S1, S2, .... ,Si, ..... ,Sn-1 ) = g. 2)Si > g, ∀ 0 ≤ i n. 3)Si ≥ Sj, ∀ j ≤ i Define a function, sum(S) = S0 + S1 + .... + Sn-1. If multiple sequences satisfy first three properties, print the one which minimizes sum(S) function. Note: ∀ means for all values of Inpu
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