public void TestGetNumber() { var index = RowWithMinimumNumberOf1.GetNumber(3, 3, new [] { 0, 0, 0, 0, 0, 0, 0, 0, 0 }); Assert.AreEqual(-1, index); index = RowWithMinimumNumberOf1.GetNumber(4, 4, new[] { 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1 }); Assert.AreEqual(0, index); index = RowWithMinimumNumberOf1.GetNumber(5, 5, new[] { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }); Assert.AreEqual(4, index); }
static void Main(string[] args) { var testCounter = int.Parse(Console.ReadLine()); var listRes = new List <int>(); for (int i = 0; i < testCounter; i++) { var str = Console.ReadLine().Split(' '); var row = int.Parse(str[0]); var col = int.Parse(str[1]); var arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); listRes.Add(RowWithMinimumNumberOf1.GetNumber(row, col, arr)); } listRes.ForEach(Console.WriteLine); Console.ReadLine(); }