当前位置: 首页>>代码示例>>C++>>正文


C++ Solution::MinAdjustmentCost方法代码示例

本文整理汇总了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;
}
开发者ID:sanus912,项目名称:leetcode-solutions,代码行数:7,代码来源:Min_Adjustment_Cost.cpp

示例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;
}
开发者ID:kof02guy,项目名称:practice,代码行数:8,代码来源:cost.cpp

示例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;
}
开发者ID:athom,项目名称:playthings,代码行数:66,代码来源:main.cpp

示例4: main

int main() {
    Solution s;
    vector<int> A = {1, 4, 2, 3};
    cout << s.MinAdjustmentCost(A, 1) << endl;  // should be 2
    return 0;
}
开发者ID:bitmingw,项目名称:LintcodeSolution,代码行数:6,代码来源:main.cpp


注:本文中的Solution::MinAdjustmentCost方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。