Advertisement
Guest User

Untitled

a guest
Jun 18th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.IO;
  7.  
  8. namespace Tier_II
  9. {
  10. class Program
  11. {
  12. public static int[][] ReadDoubleMatrix(string path)
  13. {
  14. StreamReader f = new StreamReader(path);
  15. int m = int.Parse(f.ReadLine());
  16. int[][] matrix = new int[m][];
  17. for (int i = 0; i < matrix.Length; i++)
  18. {
  19. string[] strs = f.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
  20. int[] ai = new int[strs.Length];
  21. for (int j = 0; j < ai.Length; j++)
  22. {
  23. ai[j] = int.Parse(strs[j]);
  24. }
  25. matrix[i] = ai;
  26. }
  27. f.Close();
  28. return matrix;
  29. }
  30.  
  31. static void Main(string[] args)
  32. {
  33. string path = Console.ReadLine();
  34. int max = -1;
  35. int[][] matrix = ReadDoubleMatrix(path);
  36. for (int i = 0; i<matrix.Length;i++)
  37. {
  38. int[] matrix1 = matrix[i];
  39. for(int j=0; j<matrix1.Length;j++)
  40. {
  41. if (matrix1[j] == 0)
  42. {
  43. max = i;
  44. continue;
  45. }
  46. }
  47. }
  48. Console.WriteLine(max);
  49. Console.ReadLine();
  50. }
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement