bool do_test(int N, int __expected) {
    time_t startClock = clock();
    ChooseTheBestOne *instance = new ChooseTheBestOne();
    int __result = instance->countNumber(N);
    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: " << to_string(__expected) << endl;
        cout << "           Received: " << to_string(__result) << endl;
        return false;
    }
}
double test2() {
	int p0 = 10;
	ChooseTheBestOne * obj = new ChooseTheBestOne();
	clock_t start = clock();
	int my_answer = obj->countNumber(p0);
	clock_t end = clock();
	delete obj;
	cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl;
	int p1 = 8;
	cout <<"Desired answer: " <<endl;
	cout <<"\t" << p1 <<endl;
	cout <<"Your answer: " <<endl;
	cout <<"\t" << my_answer <<endl;
	if (p1 != my_answer) {
		cout <<"DOESN'T MATCH!!!!" <<endl <<endl;
		return -1;
	}
	else {
		cout <<"Match :-)" <<endl <<endl;
		return (double)(end-start)/CLOCKS_PER_SEC;
	}
}
int main() {
    {
        ChooseTheBestOne theObject;
        eq(0, theObject.countNumber(3),2);
    }
    {
        ChooseTheBestOne theObject;
        eq(1, theObject.countNumber(6),6);
    }
    {
        ChooseTheBestOne theObject;
        eq(2, theObject.countNumber(10),8);
    }
    {
        ChooseTheBestOne theObject;
        eq(3, theObject.countNumber(1234),341);
    }
}
Exemple #4
0
// BEGIN CUT HERE
int main( int argc, char* argv[] ) {
	{
		ChooseTheBestOne theObject;
		eq(0, theObject.countNumber(3),2);
	}
	{
		ChooseTheBestOne theObject;
		eq(1, theObject.countNumber(6),6);
	}
	{
		ChooseTheBestOne theObject;
		eq(2, theObject.countNumber(10),8);
	}
	{
		ChooseTheBestOne theObject;
		eq(3, theObject.countNumber(1234),341);
	}
	return 0;
}
int main() {
	int N; cin >> N;
	ChooseTheBestOne obj;
	int ans = obj.countNumber(N);
	cout << ans << "\n";
}