P14854 [CodeChef] ARRAYRET
普及-
题目描述

Chef has an array A of length N.

Let f(i) denote the sum $A_{1} + A_{2} + \dots + A_{i}$ \, and let g(i) denote the sum $A_{i} + A_{i + 1} + \dots + A_{N}$.

Chef creates another array B of length N such that B_{i} = f(i) + g(i) for all 1 ≤ i ≤ N.

Now, Chef has lost the original array A and needs your help to recover it, given array B. It is guaranteed that Chef has obtained the array B from a valid array A.

------ Input Format ------

  • The first line contains a single integer T — the number of test cases. Then the test cases follow.
  • The first line of each test case contains an integer N — the size of the array A.
  • The second line of each test case contains $N space-separated integers B_{1}, B_{2}, \dots, B_{N}$ denoting the array B.

------ Output Format ------

For each testcase, output $N space separated integers A_{1}, A_{2}, \dots, A_{N}$ denoting the array A.

Note that 1 ≤ A_{i} ≤ 10^{5} must hold for all 1 ≤ i ≤ N and it is guaranteed that a valid array A that meets these constraints exists.

If there are multiple answers, output any.

------ Constraints ------

$1 ≤ T ≤ 1000$
$1 ≤ N ≤ 10^{5}$
$1 ≤ B_{i} ≤ 2 \cdot 10^{10}$
- Th sum of $N$ over all test cases does not exceed $10^{5}$.
$1 ≤ A_{i} ≤ 10^{5}$
- It is guaranteed that a valid array $A$ always exists.

----- Sample Input 1 ------
4
1
6
3
7 8 9
4
13 15 13 14
2
25 20

----- Sample Output 1 ------
3
1 2 3
2 4 2 3
10 5

----- explanation 1 ------
Test case 1: For $A = [3]$, $B = [6]$. $B_{1} = f(1) + g(1) = 3 + 3 = 6$.

Test case 2: For $A = [1, 2, 3]$, $B = [7, 8, 9]$.
- $B_{1} = f(1) + g(1) = \underline{1} + \underline{1 + 2 + 3} = 7$
- $B_{2} = f(2) + g(2) = \underline{1 + 2} + \underline{2 + 3} = 8$
- $B_{3} = f(3) + g(3) = \underline{1 + 2 + 3} + \underline{3} = 9$

输入格式

见题面

输出格式

见题面

样例输入
4 1 6 3 7 8 9 4 13 15 13 14 2 25 20
样例输出
3 1 2 3 2 4 2 3 10 5