// BEGIN CUT HERE void main( int argc, char* argv[] ) { { int retrunValueARRAY[] = {1, 2 }; vector <int> retrunValue( retrunValueARRAY, retrunValueARRAY+ARRSIZE(retrunValueARRAY) ); DeerInZooDivTwo theObject; eq(0, theObject.getminmax(3, 2),retrunValue); } { int retrunValueARRAY[] = {0, 1 }; vector <int> retrunValue( retrunValueARRAY, retrunValueARRAY+ARRSIZE(retrunValueARRAY) ); DeerInZooDivTwo theObject; eq(1, theObject.getminmax(3, 3),retrunValue); } { int retrunValueARRAY[] = {10, 10 }; vector <int> retrunValue( retrunValueARRAY, retrunValueARRAY+ARRSIZE(retrunValueARRAY) ); DeerInZooDivTwo theObject; eq(2, theObject.getminmax(10, 0),retrunValue); } { int retrunValueARRAY[] = {333, 493 }; vector <int> retrunValue( retrunValueARRAY, retrunValueARRAY+ARRSIZE(retrunValueARRAY) ); DeerInZooDivTwo theObject; eq(3, theObject.getminmax(654, 321),retrunValue); } { int retrunValueARRAY[] = {0, 3 }; vector <int> retrunValue( retrunValueARRAY, retrunValueARRAY+ARRSIZE(retrunValueARRAY) ); DeerInZooDivTwo theObject; eq(4, theObject.getminmax(100, 193),retrunValue); } }
// BEGIN KAWIGIEDIT TESTING // Generated by KawigiEdit 2.1.4 (beta) modified by pivanof bool KawigiEdit_RunTest(int testNum, int p0, int p1, bool hasAnswer, vector <int> p2) { cout << "Test " << testNum << ": [" << p0 << "," << p1; cout << "]" << endl; DeerInZooDivTwo *obj; vector <int> answer; obj = new DeerInZooDivTwo(); clock_t startTime = clock(); answer = obj->getminmax(p0, p1); 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" << "{"; for (int i = 0; int(p2.size()) > i; ++i) { if (i > 0) { cout << ","; } cout << p2[i]; } cout << "}" << endl; } cout << "Your answer:" << endl; cout << "\t" << "{"; for (int i = 0; int(answer.size()) > i; ++i) { if (i > 0) { cout << ","; } cout << answer[i]; } cout << "}" << endl; if (hasAnswer) { if (answer.size() != p2.size()) { res = false; } else { for (int i = 0; int(answer.size()) > i; ++i) { if (answer[i] != p2[i]) { res = false; } } } } 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; }
bool do_test(int N, int K, vector<int> __expected, int caseNo) { cout << " Testcase #" << caseNo << " ... "; time_t startClock = clock(); DeerInZooDivTwo *instance = new DeerInZooDivTwo(); vector<int> __result = instance->getminmax(N, K); double elapsed = (double)(clock() - startClock) / CLOCKS_PER_SEC; delete instance; if (__result == __expected) { cout << "PASSED!" << " (" << elapsed << " seconds)" << endl; return true; } else { cout << "FAILED!" << " (" << elapsed << " seconds)" << endl; cout << " Expected: " << pretty_print(__expected) << endl; cout << " Received: " << pretty_print(__result) << endl; return false; } }
int main (void) { DeerInZooDivTwo find; int N, K; int cnt=0; vector <int> minmax; while(true){ printf("(%d) \n", cnt++); scanf("%d %d", &N, &K); minmax = find.getminmax(N, 2*N - K); printf("Returns: {%d, %d} \n", minmax[1], minmax[0]); } return 0; }