Exemplo n.º 1
0
// BEGIN KAWIGIEDIT TESTING
// Generated by KawigiEdit 2.1.4 (beta) modified by pivanof
bool KawigiEdit_RunTest(int testNum, vector <int> p0, bool hasAnswer, int p1) {
	cout << "Test " << testNum << ": [" << "{";
	for (int i = 0; int(p0.size()) > i; ++i) {
		if (i > 0) {
			cout << ",";
		}
		cout << p0[i];
	}
	cout << "}";
	cout << "]" << endl;
	SRMCards *obj;
	int answer;
	obj = new SRMCards();
	clock_t startTime = clock();
	answer = obj->maxTurns(p0);
	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" << p1 << endl;
	}
	cout << "Your answer:" << endl;
	cout << "\t" << answer << endl;
	if (hasAnswer) {
		res = answer == p1;
	}
	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;
}
Exemplo n.º 2
0
int main(int argc, char const * argv[]) {
	SRMCards srm;
	vector<int> cards = {498, 499};
	cout << srm.maxTurns(cards) << endl;
	cards = {491, 492, 495, 497, 498, 499};
	cout << srm.maxTurns(cards) << endl;
	cards = {100, 200, 300, 400};
	cout << srm.maxTurns(cards) << endl;
	cards = {11, 12, 102, 13, 100, 101, 99, 9, 8, 1};
	cout << srm.maxTurns(cards) << endl;
	cards = {118, 321, 322, 119, 120, 320};
	cout << srm.maxTurns(cards) << endl;
	cards = {10, 11, 12, 13, 14, 1, 2, 3, 4, 5, 6, 7, 8, 9};
	cout << srm.maxTurns(cards) << endl;
	return 0;
}