fork 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.  
  14. int m = in.nextInt();
  15. int n = in.nextInt();
  16.  
  17. int A[][] = new int [m][n];
  18. int AAt[][] = new int [m][m];
  19.  
  20. for(int i=0; i<m; i++){
  21. for(int j=0; j<n; j++){
  22. A[i][j] = in.nextInt();
  23. }
  24. }
  25. for(int i=0; i<m; i++){
  26. for(int j=0; j<m; j++){
  27. int tmp=0;
  28. for(int k=0; k<n; k++){
  29. tmp+=A[i][k]*A[j][k];
  30. }
  31. AAt[i][j]=tmp;
  32. }
  33. }
  34. for(int i=0; i<m; i++){
  35. for(int j=0; j<m; j++){
  36. System.out.print(AAt[i][j]+" ");
  37. }
  38. System.out.println("");
  39. }
  40. }
  41. }
Success #stdin #stdout 0.14s 321280KB
stdin
3	5	1 2 3 4 5
0 0 0 78 92
6 7 8 9 110
stdout
55 772 630 
772 14548 10822 
630 10822 12330