fork download
  1. import java.util.*;
  2. public class Main
  3. {
  4. public static void main(String[] args)
  5.  
  6. {
  7. Scanner in = new Scanner(System.in);
  8. int n = in.nextInt();
  9. int deg[] = new int[n];
  10. for(int i = 0; i < n; i++)
  11. {
  12. for(int j = 0; j < n; j++)
  13.  
  14. {
  15. int value = in.nextInt();
  16. if (value == 1)
  17. {
  18. deg[i]++;
  19. }
  20. }
  21. }
  22. for(int i = 0; i < n; i++)
  23. {
  24. System.out.println(deg[i]);
  25. }
  26. }
  27. }
Success #stdin #stdout 0.06s 2184192KB
stdin
5
0 1 0 0 1
1 0 1 1 1
0 1 0 1 1
0 1 1 0 1
1 1 1 1 0
stdout
2
4
3
3
4