コード例 #1
0
        private static long CalculateWays(long targetTotal)
        {
            var summationHelper = new SummationHelper(targetTotal);
            var ways = summationHelper.WaysToSum(targetTotal);

            return (ways + 1); // Include just single pile
        }
コード例 #2
0
        public void FindWaysToSumToAHundred()
        {
            var summationHelper = new SummationHelper(100);
            var waysToSum = summationHelper.WaysToSum(100);
            Console.WriteLine(waysToSum);

            waysToSum.Should().Be(190569291);
        }
コード例 #3
0
 public void ConfirmExample(int targetTotal, int expectedWays)
 {
     var summationHelper = new SummationHelper(targetTotal);
     var waysToSum = summationHelper.WaysToSum(targetTotal);
     Assert.AreEqual(expectedWays, waysToSum);
 }