fork download
  1. import java.util.*;
  2. import java.lang.*;
  3.  
  4. class Main
  5. {
  6. public static void main (String[] args)
  7. {
  8. Scanner input = new Scanner(System.in);
  9. int n = input.nextInt();
  10. int m = input.nextInt();
  11. int x[][] = new int[n][];
  12. for (int i = 0; i < n; i++)
  13. x[i] = new int[m];
  14. for (int i = 0; i < n; i++)
  15. for (int j = 0; j < m; j++)
  16. x[i][j] = input.nextInt();
  17. System.out.println(m + " " + n);
  18. for (int j = 0; j < m; j++){
  19. for (int i = n - 1; i >= 0; i--)
  20. System.out.print(x[i][j] + " ");
  21. System.out.println();
  22. }
  23. }
  24. }
Success #stdin #stdout 0.07s 2249728KB
stdin
4 3
9 5 1 
10 6 2 
11 7 3 
12 8 4 
stdout
3 4
12 11 10 9 
8 7 6 5 
4 3 2 1