fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int t;
  6. cin>>t;
  7. int a=1;
  8. while(t--){
  9. int n;
  10. cin>>n;
  11. vector<vector<int>> matrix(n,vector<int>(n));
  12. for(int i=0;i<n;i++){
  13. for(int j=0;j<n;j++){
  14. cin>>matrix[i][j];
  15. }
  16. }
  17. cout<<"Test Case #"<<a<<":\n";
  18. for(int i=0;i<n;i++){
  19. for(int j=n-1;j>=0;j--){
  20. cout<<matrix[j][i]<<" ";
  21. }
  22. cout<<endl;
  23. }
  24. a++;
  25. }
  26. }
Success #stdin #stdout 0.01s 5280KB
stdin
4
1
1
2
1 2
4 3
3
1 2 3
8 9 4
7 6 5
5
-44 25 -52 69 -5 
17 22 51 27 -44 
-79 28 -78 1 -47 
65 -77 -14 -21 -6 
-96 43 -21 -20 90
stdout
Test Case #1:
1 
Test Case #2:
4 1 
3 2 
Test Case #3:
7 8 1 
6 9 2 
5 4 3 
Test Case #4:
-96 65 -79 17 -44 
43 -77 28 22 25 
-21 -14 -78 51 -52 
-20 -21 1 27 69 
90 -6 -47 -44 -5