aboutsummaryrefslogtreecommitdiff
path: root/codechef/RetriveTheArray/main.cpp
blob: 491e6db379167174b508ddcaef9428f2fbee38cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include<bits/stdc++.h>

using namespace std;

int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int tt;
	cin >> tt;
	while(tt--){
    int n;
    cin >> n;
    vector<long long> v(n);
    long long sum = 0;
    for(auto &x : v){
      cin >> x;
      sum += x;
    }
    vector<long long> ans(n);
    for(int i = 0; i < n; i++) {
      ans[i] = v[i] - sum / (n + 1);
    }
    for(auto x : ans) {
      cout << x << " ";
    }
    cout << endl;
	}
}