Ejemplo n.º 1
0
        public void Custom2()
        {
            var inputString = @"1
5
10 2 11 1 15
0 1 1 2 2";
            var io          = new TestIOStub(inputString);

            CaseSolver.Run(io);

            io.Output.Should().BeEquivalentTo(
                @"Case #1: 36"//10+11+15 = 4,3,5
                );
        }
Ejemplo n.º 2
0
        public void Custom()
        {
            var inputString = @"1
8
110 120 140 190 80 130 90 150
0 1 2 1 2 3 1 3";
            var io          = new TestIOStub(inputString);

            CaseSolver.Run(io);

            io.Output.Should().BeEquivalentTo(
                @"Case #1: 710"//11+19+12+14+15 = 7,4,5,6,8
                );
        }
Ejemplo n.º 3
0
        public void FailedFinal()
        {
            var inputString = @"1
9
601543813 362455031 504985097 57861633 426966649 170032630 319023699 251514672 645648527
0 0 1 1 1 2 2 3 7";
            var io          = new TestIOStub(inputString);

            CaseSolver.Run(io);

            io.Output.Should().BeEquivalentTo(
                @"Case #1: 2541599117"
                );
        }
Ejemplo n.º 4
0
        private static IEnumerable <string> ProcessCases(IEnumerable <List <string> > cases)
        {
            var currentCaseNumber = 0;

            foreach (var caseLines in cases)
            {
                currentCaseNumber++; //1-indexed.
                var parsedCase = new CaseInput(caseLines);
                var solver     = new CaseSolver(parsedCase);
                var result     = solver.Solve();

                var resultText = result.ToString();

                yield return($"Case #{currentCaseNumber}: {resultText}");
            }
        }
Ejemplo n.º 5
0
        public void Square()
        {
            var inputString = @"3
4
60 20 40 50
0 1 1 2
5
3 2 1 4 5
0 1 1 1 0
8
100 100 100 90 80 100 90 100
0 1 2 1 2 3 1 3";
            var io          = new TestIOStub(inputString);

            CaseSolver.Run(io);

            io.Output.Should().BeEquivalentTo(
                @"Case #1: 110",
                "Case #2: 14",
                "Case #3: 490"
                );
        }