Esempio n. 1
0
bool KawigiEdit_RunTest(int testNum, long long p0, long long p1, long long p2, bool hasAnswer, long long p3) {
	cout << "Test " << testNum << ": [" << p0 << "," << p1 << "," << p2;
	cout << "]" << endl;
	SparseFactorialDiv2 *obj;
	long long answer;
	obj = new SparseFactorialDiv2();
	clock_t startTime = clock();
	answer = obj->getCount(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;
}
Esempio n. 2
0
int main(){
		SparseFactorialDiv2 p;
		LL re = p.getCount(10000, 20000, 997);
		cout << re << endl;
		return 0;
}
// BEGIN CUT HERE
void main( int argc, char* argv[] ) {
	{
		SparseFactorialDiv2 theObject;
		eq(0, theObject.getCount(4L, 8L, 3L),3LL);
	}
	{
		SparseFactorialDiv2 theObject;
		eq(1, theObject.getCount(9L, 11L, 7L),1LL);
	}
	{
		SparseFactorialDiv2 theObject;
		eq(2, theObject.getCount(1L, 1000000000000L, 2L),999999999999LL);
	}
	{
		SparseFactorialDiv2 theObject;
		eq(3, theObject.getCount(16L, 26L, 11L),4LL);
	}
	{
		SparseFactorialDiv2 theObject;
		eq(4, theObject.getCount(10000L, 20000L, 997L),1211LL);
	}
	{
		SparseFactorialDiv2 theObject;
		eq(5, theObject.getCount(123456789L, 987654321L, 71L),438184668LL);
	}
}