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}"); } }
public void Sample() { var inputString = @"3 300000 200000 300000 500000 300000 200000 500000 300000 300000 500000 300000 200000 1000000 1000000 0 0 0 1000000 1000000 1000000 999999 999999 999999 999999 768763 148041 178147 984173 699508 515362 534729 714381 949704 625054 946212 951187"; var io = new TestIOStub(inputString); CaseSolver.Run(io); io.Output.Should().BeEquivalentTo( @"Case #1: 300000 200000 300000 200000", "Case #2: IMPOSSIBLE", "Case #3: 699508 148041 152451 0"); }