Ejemplo n.º 1
0
// BEGIN KAWIGIEDIT TESTING
// Generated by KawigiEdit 2.1.4 (beta) modified by pivanof
bool KawigiEdit_RunTest(int testNum, int p0, int p1, bool hasAnswer, double p2) {
	cout << "Test " << testNum << ": [" << p0 << "," << p1;
	cout << "]" << endl;
	FixedDiceGameDiv2 *obj;
	double answer;
	obj = new FixedDiceGameDiv2();
	clock_t startTime = clock();
	answer = obj->getExpectation(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" << p2 << endl;
	}
	cout << "Your answer:" << endl;
	cout << "\t" << answer << endl;
	if (hasAnswer) {
		res = fabs(p2 - answer) <= 1e-9 * max(1.0, fabs(p2));
	}
	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;
}
Ejemplo n.º 2
0
int main() {
    {
        FixedDiceGameDiv2 theObject;
        eq(0, theObject.getExpectation(2, 2),2.0);
    }
    {
        FixedDiceGameDiv2 theObject;
        eq(1, theObject.getExpectation(4, 2),3.2);
    }
    {
        FixedDiceGameDiv2 theObject;
        eq(2, theObject.getExpectation(3, 3),2.6666666666666665);
    }
    {
        FixedDiceGameDiv2 theObject;
        eq(3, theObject.getExpectation(11, 13),7.999999999999999);
    }
}
Ejemplo n.º 3
0
// BEGIN CUT HERE
int main(){
  FixedDiceGameDiv2 test;
  int n;
  cin >> n;
  test.run_test(n);
}