• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ VolumeGuess类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test3

int test3() {
    vector<string> queries = {"1,2,31", "1,3,9", "1,4,31", "2,4,32", "3,4,9", "3,2,9"};
    int numberOfBoxes = 4;
    int ithBox = 3;
    VolumeGuess* pObj = new VolumeGuess();
    clock_t start = clock();
    int result = pObj->correctVolume(queries, numberOfBoxes, ithBox);
    clock_t end = clock();
    delete pObj;
    int expected = 9;
    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,代码行数:18,代码来源:srm191_volumeguess.cpp


示例2: test13

int test13() {
    vector<string> queries = {"1,7,12", "2,1,12", "5,9,123", "7,6,100", "8,6,100", "6,9,100", "7,8,200", "1,5,12", "1,6,12", "1,8,12", "1,9,12", "2,3,34", "2,4,42", "3,7,34", "8,3,34", "9,3,34", "4,5,42", "4,6,42", "1,3,12", "1,4,12", "5,7,200", "5,8,300", "9,4,42", "5,6,100", "7,9,123", "8,9,123", "2,5,234", "2,6,100", "4,7,42", "4,8,42", "2,7,200", "8,2,234", "2,9,123", "3,4,34", "3,5,34", "3,6,34"};
    int numberOfBoxes = 9;
    int ithBox = 9;
    VolumeGuess* pObj = new VolumeGuess();
    clock_t start = clock();
    int result = pObj->correctVolume(queries, numberOfBoxes, ithBox);
    clock_t end = clock();
    delete pObj;
    int expected = 123;
    if(result == expected) {
        cout << "Test Case 13: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 13: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
开发者ID:rick-qiu,项目名称:topcoder,代码行数:18,代码来源:srm191_volumeguess.cpp


示例3: test35

int test35() {
    vector<string> queries = {"1,2,8", "1,3,7", "1,4,6", "1,5,5", "1,6,4", "1,7,3", "1,8,2", "1,9,1", "2,3,7", "2,4,6", "2,5,5", "2,6,4", "2,7,3", "2,8,2", "2,9,1", "3,4,6", "3,5,5", "3,6,4", "3,7,3", "3,8,2", "3,9,1", "4,5,5", "4,6,4", "4,7,3", "4,8,2", "4,9,1", "5,6,4", "5,7,3", "5,8,2", "5,9,1", "6,7,3", "6,8,2", "6,9,1", "7,8,2", "7,9,1", "8,9,1"};
    int numberOfBoxes = 9;
    int ithBox = 3;
    VolumeGuess* pObj = new VolumeGuess();
    clock_t start = clock();
    int result = pObj->correctVolume(queries, numberOfBoxes, ithBox);
    clock_t end = clock();
    delete pObj;
    int expected = 7;
    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,代码来源:srm191_volumeguess.cpp


示例4: test6

int test6() {
    vector<string> queries = {"3,2,80", "5,2,15", "1,2,193", "3,1,80", "5,1,15", "5,3,15", "3,4,3", "4,5,3", "2,4,3", "4,1,3"};
    int numberOfBoxes = 5;
    int ithBox = 5;
    VolumeGuess* pObj = new VolumeGuess();
    clock_t start = clock();
    int result = pObj->correctVolume(queries, numberOfBoxes, ithBox);
    clock_t end = clock();
    delete pObj;
    int expected = 15;
    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,代码来源:srm191_volumeguess.cpp


示例5: KawigiEdit_RunTest

// BEGIN KAWIGIEDIT TESTING
// Generated by KawigiEdit 2.1.4 (beta) modified by pivanof
bool KawigiEdit_RunTest(int testNum, vector <string> p0, int p1, int p2, bool hasAnswer, int p3) {
	cout << "Test " << testNum << ": [" << "{";
	for (int i = 0; int(p0.size()) > i; ++i) {
		if (i > 0) {
			cout << ",";
		}
		cout << "\"" << p0[i] << "\"";
	}
	cout << "}" << "," << p1 << "," << p2;
	cout << "]" << endl;
	VolumeGuess *obj;
	int answer;
	obj = new VolumeGuess();
	clock_t startTime = clock();
	answer = obj->correctVolume(p0, p1, p2);
	clock_t endTime = clock();
	delete obj;
	bool res;
	res = true;
	cout << "Time: " << double(endTime - startTime) / CLOCKS_PER_SEC << " seconds" << endl;
	if (hasAnswer) {
		cout << "Desired answer:" << endl;
		cout << "\t" << p3 << endl;
	}
	cout << "Your answer:" << endl;
	cout << "\t" << answer << endl;
	if (hasAnswer) {
		res = answer == p3;
	}
	if (!res) {
		cout << "DOESN'T MATCH!!!!" << endl;
	} else if (double(endTime - startTime) / CLOCKS_PER_SEC >= 2) {
		cout << "FAIL the timeout" << endl;
		res = false;
	} else if (hasAnswer) {
		cout << "Match :-)" << endl;
	} else {
		cout << "OK, but is it right?" << endl;
	}
	cout << "" << endl;
	return res;
}
开发者ID:hophacker,项目名称:algorithm_coding,代码行数:44,代码来源:VolumeGuess.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ VolumeManager类代码示例发布时间:2022-05-31
下一篇:
C++ VolumeCollection类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap