← All problemsSign in

Train to Codetown (Easy)

Codetown has a unique concept of seating people in a train. Each train has N coaches and Coaches are indexed as 1,2,3... N as first , second , third .... Nth coach. For each ith coach if gcd of all pairs in the set {i, i+1 , i+2} is 1 then the ith coach is seated with i people. Else if gcd of any of the pair is not 1, then the coach will be kept empty. Your task is to evaluate the no. of people

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