コード例 #1
0
        public void WhenThen(string input, string expected)
        {
            var reader      = new StringReader(input);
            var expectedArr = expected.Split(',');
            var algorithm   = new NewYearChaos();

            int t = Convert.ToInt32(reader.ReadLine());

            for (int tItr = 0; tItr < t; tItr++)
            {
                int n = Convert.ToInt32(reader.ReadLine());

                int[] q      = Array.ConvertAll(reader.ReadLine().Split(' '), qTemp => Convert.ToInt32(qTemp));
                var   result = algorithm.minimumBribes(q);

                Assert.AreEqual(expectedArr[tItr], result);
            }
        }
コード例 #2
0
        public void Run()
        {
            PrintProblem();

            Console.WriteLine("t:");
            int t = Convert.ToInt32(Console.ReadLine());

            for (int tItr = 0; tItr < t; tItr++)
            {
                Console.WriteLine("n:");
                int n = Convert.ToInt32(Console.ReadLine());

                Console.WriteLine("q:");
                int[] q = System.Array.ConvertAll(Console.ReadLine().Split(' '), qTemp => Convert.ToInt32(qTemp))
                ;
                NewYearChaos.minimumBribes(q);
                Console.ReadKey();
            }
        }