Sum Product Segments
A *segment* is a range of **non-negative** integers $L, L + 1, L + 2, \ldots, R$, denoted $[L, R]$ where $L \leq R$. Chef has a set $S$ consisting of **all** segments $[L, R]$ such that either $L + R = X$ or $L\cdot R = Y$. For example, if $X = 5$ and $Y = 6$, then Chef's set is $S = \{[0, 5], [1, 4], [1, 6], [2, 3]\}$. Given the integers $X$ and $Y$, can you help Chef find two non-intersecting
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