Exemplo n.º 1
0
        public override string SolvePart1( )
        {
            var options = new CombinatorOptions
            {
                IsFullSet       = true,
                IsElementUnique = true,
                IsOrdered       = false
            };

            var result = Combinator.Generate(new List <string> {
                "0", "1", "2", "3", "4"
            }, options)
                         .Select(r => r.Select(int.Parse))
                         .Select(l => l.Aggregate(0d, (sum, d) => sum += containers[d]))
                         .Count(sum => sum == Liters);

            return(result.ToString( ));
        }
Exemplo n.º 2
0
        public void CombinatorTests(CombinatorTestData <string> data)
        {
            var actual = Combinator.Generate(data.Elements, data.Options);

            Assert.AreEqual(data.Expected, actual.Result);
        }