List of Sums
List A consists of n positive integers, and list B contains the sum of each element pair of list A. For example, if A=[1,2,3], then B=[3,4,5], and if A=[1,3,3,3], then B=[4,4,4,6,6,6]. Given list B, your task is to reconstruct list A. Input The first input line has an integer n: the size of list A. The next line has \frac{n(n-1)}{2} integers: the contents of list B. You can assume that there
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