本文整理汇总了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;未经允许,请勿转载。 |
请发表评论