fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Scanner in = new Scanner(System.in);
  13. int n = in.nextInt();
  14. int[][] a = new int[n][n];
  15. for(int i = 0; i<n;i ++)
  16. {
  17. for(int j = 0; j<n;j ++)
  18. {
  19. a[i][j] = in.nextInt();
  20. }
  21. }
  22. int[][] b = new int[n][n];
  23. for(int i = 0; i<n;i ++)
  24. {
  25. for(int j = 0; j<n;j ++)
  26. {
  27. b[i][j] = a[n-i][n-j];
  28. }
  29. }
  30. for(int i = 0; i<n;i ++)
  31. {
  32. for(int j = 0; j<n;j ++)
  33. {
  34. System.out.print(b[i][j]);
  35. }
  36. System.out.println();
  37. }
  38. }
  39. }
Runtime error #stdin #stdout #stderr 0.07s 2184192KB
stdin
3
1 2 3
4 5 6
7 8 9
stdout
Standard output is empty
stderr
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3
	at Ideone.main(Main.java:27)