75 std::array<int32_t, n1> price1 = {1, 2, 4, 6, 8, 45, 21, 9};
76 const int64_t max_profit1 =
77 dynamic_programming::cut_rod::maxProfitByCuttingRod(price1, n1);
78 const int64_t expected_max_profit1 = 47;
79 assert(max_profit1 == expected_max_profit1);
80 std::cout <<
"Maximum profit with " << n1 <<
" inch road is " << max_profit1
84 const int16_t n2 = 30;
85 std::array<int32_t, n2> price2 = {
86 1, 5, 8, 9, 10, 17, 17, 20, 24, 30,
87 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
88 41, 42, 43, 44, 45, 46, 47, 48, 49, 50};
90 const int64_t max_profit2 =
91 dynamic_programming::cut_rod::maxProfitByCuttingRod(price2, n2);
92 const int32_t expected_max_profit2 = 90;
93 assert(max_profit2 == expected_max_profit2);
94 std::cout <<
"Maximum profit with " << n2 <<
" inch road is " << max_profit2
98 std::array<int32_t, n3> price3 = {2, 9, 17, 23, 45};
99 const int64_t max_profit3 =
100 dynamic_programming::cut_rod::maxProfitByCuttingRod(price3, n3);
101 const int64_t expected_max_profit3 = 45;
102 assert(max_profit3 == expected_max_profit3);
103 std::cout <<
"Maximum profit with " << n3 <<
" inch road is " << max_profit3