problemscpp
A collection of my answers to algorithm problems in c++.
| 函数
leetcode::append_k_integers_with_minimal_sum 命名空间参考

LeetCode 6017. 向数组中追加 K 个整数 更多...

class  Solution
 

函数

 TEST (append_k_integers_with_minimal_sum, case1)
 
 TEST (append_k_integers_with_minimal_sum, case2)
 
 TEST (append_k_integers_with_minimal_sum, case3)
 
 TEST (append_k_integers_with_minimal_sum, case4)
 
 TEST (append_k_integers_with_minimal_sum, case5)
 

详细描述

LeetCode 6017. 向数组中追加 K 个整数

函数说明

◆ TEST() [1/5]

leetcode::append_k_integers_with_minimal_sum::TEST ( append_k_integers_with_minimal_sum  ,
case1   
)

在文件 leetcode_test.cpp2044 行定义.

2044 {
2045 vector input = {96, 44, 99, 25, 61, 84, 88, 18, 19, 33, 60, 86, 52, 19, 32, 47, 35, 50, 94, 17, 29, 98, 22, 21, 72, 100, 40, 84};
2046 ASSERT_EQ(794, Solution::minimalKSum(input, 35));
2047 }

引用了 leetcode::append_k_integers_with_minimal_sum::Solution::minimalKSum().

◆ TEST() [2/5]

leetcode::append_k_integers_with_minimal_sum::TEST ( append_k_integers_with_minimal_sum  ,
case2   
)

在文件 leetcode_test.cpp2049 行定义.

2049 {
2050 vector input = {5, 6};
2051 ASSERT_EQ(25, Solution::minimalKSum(input, 6));
2052 }

引用了 leetcode::append_k_integers_with_minimal_sum::Solution::minimalKSum().

◆ TEST() [3/5]

leetcode::append_k_integers_with_minimal_sum::TEST ( append_k_integers_with_minimal_sum  ,
case3   
)

在文件 leetcode_test.cpp2054 行定义.

2054 {
2055 vector input = {1, 4, 25, 10, 25};
2056 ASSERT_EQ(5, Solution::minimalKSum(input, 2));
2057 }

引用了 leetcode::append_k_integers_with_minimal_sum::Solution::minimalKSum().

◆ TEST() [4/5]

leetcode::append_k_integers_with_minimal_sum::TEST ( append_k_integers_with_minimal_sum  ,
case4   
)

在文件 leetcode_test.cpp2059 行定义.

2059 {
2060 vector input = {1, 2};
2061 ASSERT_EQ(3, Solution::minimalKSum(input, 1));
2062 }

引用了 leetcode::append_k_integers_with_minimal_sum::Solution::minimalKSum().

◆ TEST() [5/5]

leetcode::append_k_integers_with_minimal_sum::TEST ( append_k_integers_with_minimal_sum  ,
case5   
)

在文件 leetcode_test.cpp2064 行定义.

2064 {
2065 vector input = {2, 2, 2, 2};
2066 ASSERT_EQ(8, Solution::minimalKSum(input, 3));
2067 }

引用了 leetcode::append_k_integers_with_minimal_sum::Solution::minimalKSum().