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 Ideone
  8. {
  9. public static Scanner sc = new Scanner(System.in);
  10.  
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13. int n = sc.nextInt();
  14. if( n >= 1 && n <= 100){
  15. int sum = 0;
  16. for(int i = 0; i < n; i++){
  17. for(int j = 0; j < n; j++){
  18. sum += sc.nextInt();
  19. }
  20. }
  21. System.out.println(String.format("%d", sum));
  22. }
  23.  
  24. }
  25. }
Success #stdin #stdout 0.12s 52904KB
stdin
3
1 0 1
1 1 0
0 1 1
stdout
6