← All problemsSign in

Stick and polygon

CodeChefRating 2935Open on judge ↗

Creatnx, a 7-year-old child, is playing with $7$ sticks with lengths $1, 2, \ldots, 7$, which can be connected together. He is trying to use some of them to create a polygon. Trans, his father, is looking, and since he is a programmer, he quickly comes up with a problem based on this game: There are $N$ sticks (line segments) with lengths $1, 2, 3, \ldots, N$. You should choose a non-empty subs

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