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 n = in.nextInt();
  15.  
  16. int M[][] = new int[n][n];
  17. Vector<Integer> v = new Vector<Integer>();
  18.  
  19. for (int i=0; i<n; i++){
  20. for (int j=0; j<n; j++){
  21. M[i][j] = in.nextInt();
  22. }
  23. }
  24.  
  25. for (int i=0; i<n; i++){
  26. int k=0;
  27. for (int j=0; (j<n)&&(M[i][j]==0); j++){
  28. k++;
  29. }
  30. if(k==n){
  31. v.add(i);
  32. }
  33. }
  34. for (int i : v){
  35. System.out.print(i+1+" ");
  36. }
  37. if (v.isEmpty()) {
  38. System.out.print("Таких строк нет.");
  39. }
  40. }
  41. }
Success #stdin #stdout 0.15s 321280KB
stdin
4	
0	0	0	0
0	-290	56	48
0	0	0	0
1	2	3	4
stdout
1 3