本文整理汇总了C++中Solution::MinAdjustmentCost方法的典型用法代码示例。如果您正苦于以下问题:C++ Solution::MinAdjustmentCost方法的具体用法?C++ Solution::MinAdjustmentCost怎么用?C++ Solution::MinAdjustmentCost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Solution
的用法示例。
在下文中一共展示了Solution::MinAdjustmentCost方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main() {
vector<int> A = {1,4,2,3};
Solution mySol;
cout << mySol.MinAdjustmentCost(A,1) << endl;
return 0;
}
示例2: main
int main()
{
int arr[4] = {1,4,2,3};
vector<int> arrVec(arr, arr + 4);
Solution s;
cout << s.MinAdjustmentCost(arrVec, 1) << endl;
return 0;
}
示例3: main
int main(int argc, char *argv[])
{
Solution s;
vector<int> v;
int r;
int a4[] = {1, 4, 7, 3};
v = seed_array(a4, 4);
r = s.MinAdjustmentCost(v, 1);
assert(r == 5);
int a6[] = {1,1,1,1,1, 1,1,1,1,1, 1,1,1};
v = seed_array(a6, 13);
r = s.MinAdjustmentCost(v, 1);
assert(r == 0);
int a7[] = {1,100,2,99,3, 98,4,97,5,96, 1,10,15,16,19, 10,1,2,3,4, 95};
v = seed_array(a7, 21);
r = s.MinAdjustmentCost(v, 79);
assert(r == 96);
int a8[] = {51,62,81,14,15, 39,63,38,48,94, 42,91,91,81,91, 40,67,66,82,16};
v = seed_array(a8, 20);
r = s.MinAdjustmentCost(v, 20);
assert(r == 188);
int a5[] = {12,3,7,4,5,13,2,8,4,7,6,5,7};
v = seed_array(a5, 13);
r = s.MinAdjustmentCost(v, 2);
assert(r == 19);
int a3[] = {20,25,35,45,55, 65,75,85,25,35, 45,55,15,15,15, 7,2,11,15,11, 15};
//65 55 45 35 25
//20 30 10 20 10
v = seed_array(a3, 21);
r = s.MinAdjustmentCost(v, 10);
assert(r == 90);
int a0[] = {1, 4, 7, 3};
v = seed_array(a0, 4);
r = s.MinAdjustmentCost(v, 1);
assert(r == 5);
int a1[] = {1, 4, 2, 3};
v = seed_array(a1, 4);
r = s.MinAdjustmentCost(v, 1);
assert(r == 2);
int a2[] = {1, 4, 7};
v = seed_array(a2, 3);
r = s.MinAdjustmentCost(v, 1);
assert(r == 4);
v.clear();
r = s.MinAdjustmentCost(v, 1);
assert(r == 0);
v.clear();
v.push_back(41);
r = s.MinAdjustmentCost(v, 1);
assert(r == 0);
return 0;
}
示例4: main
int main() {
Solution s;
vector<int> A = {1, 4, 2, 3};
cout << s.MinAdjustmentCost(A, 1) << endl; // should be 2
return 0;
}