예제 #1
0
int main(void){
	ColorfulBoxesAndBalls c = ColorfulBoxesAndBalls();

	cout << c.getMaximum(2, 3, 100, 400, 200) << endl;
	cout << c.getMaximum(1, 4, 20, -30, -10) << endl;
	cout << c.getMaximum(9, 1, -1, -10, 4) << endl;

	cout << c.getMaximum(100, 100, -1, -10, 4) << endl;

	return 0;
}
예제 #2
0
int test3() {
    int numRed = 1;
    int numBlue = 4;
    int onlyRed = 20;
    int onlyBlue = -30;
    int bothColors = -10;
    ColorfulBoxesAndBalls* pObj = new ColorfulBoxesAndBalls();
    clock_t start = clock();
    int result = pObj->getMaximum(numRed, numBlue, onlyRed, onlyBlue, bothColors);
    clock_t end = clock();
    delete pObj;
    int expected = -100;
    if(result == expected) {
        cout << "Test Case 3: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 3: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}