diff options
Diffstat (limited to 'codechef/RetriveTheArray/main.cpp')
| -rw-r--r-- | codechef/RetriveTheArray/main.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/codechef/RetriveTheArray/main.cpp b/codechef/RetriveTheArray/main.cpp new file mode 100644 index 0000000..491e6db --- /dev/null +++ b/codechef/RetriveTheArray/main.cpp @@ -0,0 +1,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; + } +} |
