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


C++ CombinationLock::degreesTurned方法代码示例

本文整理汇总了C++中CombinationLock::degreesTurned方法的典型用法代码示例。如果您正苦于以下问题:C++ CombinationLock::degreesTurned方法的具体用法?C++ CombinationLock::degreesTurned怎么用?C++ CombinationLock::degreesTurned使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CombinationLock的用法示例。


在下文中一共展示了CombinationLock::degreesTurned方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: test3

double test3() {
    int t0[] = {64,93,87,3,22,53,64,53,11,90,11,59,30,6,11,17,72,0,38,55};
    vector <int> p0(t0, t0+sizeof(t0)/sizeof(int));
    int p1 = 97;
    int p2 = 26;
    CombinationLock * obj = new CombinationLock();
    clock_t start = clock();
    double my_answer = obj->degreesTurned(p0, p1, p2);
    clock_t end = clock();
    delete obj;
    cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl;
    double p3 = 79166.59793814432;
    cout <<"Desired answer: " <<endl;
    cout <<"\t" << p3 <<endl;
    cout <<"Your answer: " <<endl;
    cout <<"\t" << my_answer <<endl;
    if (p3 != my_answer) {
        cout <<"DOESN'T MATCH!!!!" <<endl <<endl;
        return -1;
    }
    else {
        cout <<"Match :-)" <<endl <<endl;
        return (double)(end-start)/CLOCKS_PER_SEC;
    }
}
开发者ID:sreelakshmib,项目名称:topcoder_srm,代码行数:25,代码来源:CombinationLock.cpp

示例2: test1

double test1() {
    int t0[] = {0,50,99};
    vector <int> p0(t0, t0+sizeof(t0)/sizeof(int));
    int p1 = 100;
    int p2 = 65;
    CombinationLock * obj = new CombinationLock();
    clock_t start = clock();
    double my_answer = obj->degreesTurned(p0, p1, p2);
    clock_t end = clock();
    delete obj;
    cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl;
    double p3 = 2642.4;
    cout <<"Desired answer: " <<endl;
    cout <<"\t" << p3 <<endl;
    cout <<"Your answer: " <<endl;
    cout <<"\t" << my_answer <<endl;
    if (p3 != my_answer) {
        cout <<"DOESN'T MATCH!!!!" <<endl <<endl;
        return -1;
    }
    else {
        cout <<"Match :-)" <<endl <<endl;
        return (double)(end-start)/CLOCKS_PER_SEC;
    }
}
开发者ID:sreelakshmib,项目名称:topcoder_srm,代码行数:25,代码来源:CombinationLock.cpp

示例3: test41

int test41() {
    vector<int> combo = {64, 93, 87, 3, 22, 53, 64, 53, 11, 90, 11, 59, 30, 6, 11, 17, 72, 0, 38, 55};
    int size = 97;
    int start = 96;
    CombinationLock* pObj = new CombinationLock();
    clock_t start = clock();
    double result = pObj->degreesTurned(combo, size, start);
    clock_t end = clock();
    delete pObj;
    double expected = 79266.80412371134;
    if(result == expected) {
        cout << "Test Case 41: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 41: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
开发者ID:rick-qiu,项目名称:topcoder,代码行数:18,代码来源:srm181_combinationlock.cpp

示例4: test2

int test2() {
    vector<int> combo = {18, 74, 43};
    int size = 77;
    int start = 22;
    CombinationLock* pObj = new CombinationLock();
    clock_t start = clock();
    double result = pObj->degreesTurned(combo, size, start);
    clock_t end = clock();
    delete pObj;
    double expected = 2814.5454545454545;
    if(result == expected) {
        cout << "Test Case 2: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 2: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
开发者ID:rick-qiu,项目名称:topcoder,代码行数:18,代码来源:srm181_combinationlock.cpp

示例5: test35

int test35() {
    vector<int> combo = {3, 4, 19, 46, 64, 23, 71, 55, 60, 73, 20, 25};
    int size = 77;
    int start = 15;
    CombinationLock* pObj = new CombinationLock();
    clock_t start = clock();
    double result = pObj->degreesTurned(combo, size, start);
    clock_t end = clock();
    delete pObj;
    double expected = 30389.61038961039;
    if(result == expected) {
        cout << "Test Case 35: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 35: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
开发者ID:rick-qiu,项目名称:topcoder,代码行数:18,代码来源:srm181_combinationlock.cpp

示例6: test33

int test33() {
    vector<int> combo = {54, 35, 16, 1, 21, 25, 39, 50, 18, 13, 31, 5, 44, 51, 31, 57, 7, 31, 27, 28, 46, 43, 12, 5, 24, 13, 10, 25, 27, 14, 17, 18, 47, 33, 17};
    int size = 63;
    int start = 57;
    CombinationLock* pObj = new CombinationLock();
    clock_t start = clock();
    double result = pObj->degreesTurned(combo, size, start);
    clock_t end = clock();
    delete pObj;
    double expected = 232965.71428571423;
    if(result == expected) {
        cout << "Test Case 33: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 33: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
开发者ID:rick-qiu,项目名称:topcoder,代码行数:18,代码来源:srm181_combinationlock.cpp

示例7: test31

int test31() {
    vector<int> combo = {60, 0, 66, 17, 4, 63, 30, 21, 20, 24, 47, 22, 9, 64};
    int size = 69;
    int start = 43;
    CombinationLock* pObj = new CombinationLock();
    clock_t start = clock();
    double result = pObj->degreesTurned(combo, size, start);
    clock_t end = clock();
    delete pObj;
    double expected = 40690.4347826087;
    if(result == expected) {
        cout << "Test Case 31: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 31: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
开发者ID:rick-qiu,项目名称:topcoder,代码行数:18,代码来源:srm181_combinationlock.cpp

示例8: test29

int test29() {
    vector<int> combo = {60, 69, 8, 35, 40, 1, 53, 29, 48};
    int size = 74;
    int start = 38;
    CombinationLock* pObj = new CombinationLock();
    clock_t start = clock();
    double result = pObj->degreesTurned(combo, size, start);
    clock_t end = clock();
    delete pObj;
    double expected = 17591.351351351354;
    if(result == expected) {
        cout << "Test Case 29: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 29: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
开发者ID:rick-qiu,项目名称:topcoder,代码行数:18,代码来源:srm181_combinationlock.cpp

示例9: test11

int test11() {
    vector<int> combo = {7, 9, 4, 10, 6, 1, 6, 10, 3};
    int size = 11;
    int start = 9;
    CombinationLock* pObj = new CombinationLock();
    clock_t start = clock();
    double result = pObj->degreesTurned(combo, size, start);
    clock_t end = clock();
    delete pObj;
    double expected = 18065.454545454544;
    if(result == expected) {
        cout << "Test Case 11: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 11: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
开发者ID:rick-qiu,项目名称:topcoder,代码行数:18,代码来源:srm181_combinationlock.cpp

示例10: test10

int test10() {
    vector<int> combo = {44, 24, 57, 27, 9, 44, 75, 54, 31, 61, 65, 3, 46, 77};
    int size = 83;
    int start = 70;
    CombinationLock* pObj = new CombinationLock();
    clock_t start = clock();
    double result = pObj->degreesTurned(combo, size, start);
    clock_t end = clock();
    delete pObj;
    double expected = 40311.32530120482;
    if(result == expected) {
        cout << "Test Case 10: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 10: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
开发者ID:rick-qiu,项目名称:topcoder,代码行数:18,代码来源:srm181_combinationlock.cpp

示例11: test9

int test9() {
    vector<int> combo = {38, 7, 24, 1, 36, 16, 48, 3, 31, 2, 3, 2, 26, 48, 28, 7, 53, 60, 11, 35, 8, 42, 23, 54, 17, 46, 40, 10, 27, 38, 34, 6, 48, 60, 10, 23, 15, 58, 29, 49, 1, 32, 53};
    int size = 61;
    int start = 24;
    CombinationLock* pObj = new CombinationLock();
    clock_t start = clock();
    double result = pObj->degreesTurned(combo, size, start);
    clock_t end = clock();
    delete pObj;
    double expected = 348432.7868852459;
    if(result == expected) {
        cout << "Test Case 9: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 9: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
开发者ID:rick-qiu,项目名称:topcoder,代码行数:18,代码来源:srm181_combinationlock.cpp

示例12: test8

int test8() {
    vector<int> combo = {12, 21, 87, 40, 61, 50, 3, 24, 82, 62, 43, 25, 62, 25};
    int size = 90;
    int start = 36;
    CombinationLock* pObj = new CombinationLock();
    clock_t start = clock();
    double result = pObj->degreesTurned(combo, size, start);
    clock_t end = clock();
    delete pObj;
    double expected = 40380.0;
    if(result == expected) {
        cout << "Test Case 8: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 8: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
开发者ID:rick-qiu,项目名称:topcoder,代码行数:18,代码来源:srm181_combinationlock.cpp

示例13: test7

int test7() {
    vector<int> combo = {31, 15, 57, 21, 9, 31, 20, 35, 28};
    int size = 60;
    int start = 25;
    CombinationLock* pObj = new CombinationLock();
    clock_t start = clock();
    double result = pObj->degreesTurned(combo, size, start);
    clock_t end = clock();
    delete pObj;
    double expected = 18198.0;
    if(result == expected) {
        cout << "Test Case 7: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 7: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
开发者ID:rick-qiu,项目名称:topcoder,代码行数:18,代码来源:srm181_combinationlock.cpp

示例14: test6

int test6() {
    vector<int> combo = {9, 40, 79, 78, 33, 16, 11, 7, 41, 88, 6, 48, 85, 80, 88, 64, 96, 79, 66, 69, 2, 17, 8, 54};
    int size = 99;
    int start = 23;
    CombinationLock* pObj = new CombinationLock();
    clock_t start = clock();
    double result = pObj->degreesTurned(combo, size, start);
    clock_t end = clock();
    delete pObj;
    double expected = 111949.0909090909;
    if(result == expected) {
        cout << "Test Case 6: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 6: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
开发者ID:rick-qiu,项目名称:topcoder,代码行数:18,代码来源:srm181_combinationlock.cpp

示例15: test19

int test19() {
    vector<int> combo = {48, 15, 29, 78, 20, 64, 9, 73, 24, 64, 30, 35, 73, 14, 7, 38, 66, 13, 28, 82, 43, 24, 21, 8, 37, 44, 75, 38, 36, 28, 45, 41, 44, 74, 75, 20, 10, 0, 10, 35, 21, 40, 26, 10, 12, 33, 4};
    int size = 84;
    int start = 50;
    CombinationLock* pObj = new CombinationLock();
    clock_t start = clock();
    double result = pObj->degreesTurned(combo, size, start);
    clock_t end = clock();
    delete pObj;
    double expected = 414180.0;
    if(result == expected) {
        cout << "Test Case 19: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 19: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
开发者ID:rick-qiu,项目名称:topcoder,代码行数:18,代码来源:srm181_combinationlock.cpp


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