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. class Main {
  8. public static void main(String[] args) {
  9. Scanner in = new Scanner(System.in);
  10. int n = in.nextInt();
  11. double[][] a = new double[n][n];
  12. double[]res = new double[n];
  13. for( int i=0 ; i<n ; i++ ){
  14. res[i] = 0;
  15. }
  16. for( int j=0 ; j<n ; j++ ){
  17. for( int i=0 ; i<n ; i++ ){
  18. a[i][j] = in.nextInt();
  19. res[j] += a[i][j]*(1.0/((i+1)*(i+1)+2));
  20. }
  21. System.out.println("res["+j+"] ="+res[j]);
  22. }
  23. }
  24. }
Success #stdin #stdout 0.07s 711680KB
stdin
2
1 2 3 4
stdout
res[0] =0.6666666666666666
res[1] =1.6666666666666665