fork download
  1. #include <iostream>
  2. using namespace std;
  3. int main (){
  4. int t;
  5. cin >> t;
  6. while(t--){
  7. int n;
  8. cin >> n;
  9. int arr[n];
  10. int arr2[n];
  11. for(int i=0; i<n; i++){
  12. cin >> arr[i];
  13. arr2[i] = n+1 - arr[i];
  14. cout << arr2[i] << " ";
  15. }
  16. cout << endl;
  17. }
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0.01s 5272KB
stdin
5
5
1 2 4 5 3
2
1 2
1
1
3
3 2 1
4
1 4 3 2
stdout
5 4 2 1 3 
2 1 
1 
1 2 3 
4 1 2 3