Exemplo n.º 1
0
        public void TheCoinChangeProblem_test_2()
        {
            // arrange
            long[] c = new long[] { 2, 5, 3, 6 };

            // act
            long result = TheCoinChangeProblem.GetWays(10, c);

            // assert
            result.Should().Be(5);
        }
Exemplo n.º 2
0
        public void TheCoinChangeProblem_test()
        {
            // arrange
            long[] c = new long[] { 1, 2, 3 };

            // act
            long result = TheCoinChangeProblem.GetWays(4, c);

            // assert
            result.Should().Be(4);
        }
        public void MainFlow(string inputString)
        {
            var input = new StringReader(inputString);
            var algor = new TheCoinChangeProblem();

            string[] nm = input.ReadLine().Split(' ');

            int n = Convert.ToInt32(nm[0]);

            int m = Convert.ToInt32(nm[1]);

            long[] c = Array.ConvertAll(input.ReadLine().Split(' '), cTemp => Convert.ToInt64(cTemp))
            ;
            // Print the number of ways of making change for 'n' units using coins having the values given by 'c'

            long ways = algor.getWays(n, c);
        }