fork download
  1. #include <bits/stdc++.h>
  2. #define int long long
  3. typedef long long ll;
  4. using namespace std;
  5.  
  6. void solve() {
  7. int n;
  8. cin>>n;
  9. vector<int> v(n);
  10. for(int i=0;i<n;i++)cin>>v[i];
  11. int x=0;
  12. int i=0,j=n-1;
  13. while(i<j){
  14. int z=abs(v[i]-v[j]);
  15. cout<<z<<endl;
  16. i++;
  17. j--;
  18. }
  19. }
  20.  
  21. signed main() {
  22. int t;
  23. cin >> t;
  24. while (t--) {
  25. solve();
  26. }
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0.01s 5288KB
stdin
4
2
1 2
8
3 0 1 2 0 3 2 1
1
0
3
100 1 1000000000
stdout
1
2
2
2
2
999999900