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


C++ GeneralChess类代码示例

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


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

示例1: main

int main()
{
    GeneralChess g;
    vector<string> v{"-1000,1000", "-999,999", "-999,997"};
    vector<string>ans = g.attackPositions(v);
    for(int i=0; i<ans.size(); ++i)
    {
        cout<<ans[i]<<"\t";
    }
    return 0;
}
开发者ID:ajaymonga,项目名称:codechef,代码行数:11,代码来源:GeneralChess.cpp

示例2: test31

int test31() {
    vector<string> pieces = {"-3,0"};
    GeneralChess* pObj = new GeneralChess();
    clock_t start = clock();
    vector<string> result = pObj->attackPositions(pieces);
    clock_t end = clock();
    delete pObj;
    vector<string> expected = {"-5,-1", "-5,1", "-4,-2", "-4,2", "-2,-2", "-2,2", "-1,-1", "-1,1"};
    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,代码行数:16,代码来源:srm197_generalchess.cpp

示例3: test3

int test3() {
    vector<string> pieces = {"-1000,1000", "-999,999", "-999,997"};
    GeneralChess* pObj = new GeneralChess();
    clock_t start = clock();
    vector<string> result = pObj->attackPositions(pieces);
    clock_t end = clock();
    delete pObj;
    vector<string> expected = {"-1001,998"};
    if(result == expected) {
        cout << "Test Case 3: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 3: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
开发者ID:rick-qiu,项目名称:topcoder,代码行数:16,代码来源:srm197_generalchess.cpp

示例4: test30

int test30() {
    vector<string> pieces = {"42,5"};
    GeneralChess* pObj = new GeneralChess();
    clock_t start = clock();
    vector<string> result = pObj->attackPositions(pieces);
    clock_t end = clock();
    delete pObj;
    vector<string> expected = {"40,4", "40,6", "41,3", "41,7", "43,3", "43,7", "44,4", "44,6"};
    if(result == expected) {
        cout << "Test Case 30: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 30: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
开发者ID:rick-qiu,项目名称:topcoder,代码行数:16,代码来源:srm197_generalchess.cpp


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