Sum of the Others
Replace every element with the sum of all OTHER elements and print the result.
Input: the first line has N; the second line has N integers.
Output: N integers: total − ai per position.
Constraints:
- 1 ≤ N ≤ 105
- -10000 ≤ ai ≤ 10000
Sample Tests
Input 1
3 1 2 3
Output 1
5 4 3
Input 2
1 5
Output 2
0
Discussion (opens after you solve — no spoilers before)
No comments yet.