예제 #1
0
        public void KnapsackDiscreteNoRepeatTest()
        {
            var W       = 10;
            var n       = 3;
            var weights = new int[] { 1, 4, 8 };

            var dynamicProgramming = new DynamicProgramming();

            Console.WriteLine(dynamicProgramming.DiscreteKnapsackNoRepeats(W, weights, n));
        }
예제 #2
0
        public void DiscreteKnapsackTest()
        {
            var W       = 10;
            var weights = new long[] { 6, 3, 4, 2 };
            var values  = new long[] { 30, 14, 16, 9 };

            var dynamicProgramming = new DynamicProgramming();

            Console.WriteLine(dynamicProgramming.DiscreteKnapsack(W, weights, values));
        }
예제 #3
0
        public void RecursiveChangeTest()
        {
            var money = int.Parse(Console.ReadLine());

            var coinsInput = Console.ReadLine().Split(' ');

            var coins = new long[coinsInput.Length];

            for (var i = 0; i < coins.Length; i++)
            {
                coins[i] = long.Parse(coinsInput[i]);
            }

            var dynamicProgramming = new DynamicProgramming();

            Console.WriteLine(dynamicProgramming.RecursiveChange(money, coins));
        }
예제 #4
0
        public void PrimitiveCalculatorTest()
        {
            var dynamicProgramming = new DynamicProgramming();

            dynamicProgramming.PrimitiveCalculator(96234);
        }