int main( int argc, char* argv[] ) { { AlternateColors2 theObject; eq(0, theObject.countWays(1, 1),1LL); } { AlternateColors2 theObject; eq(1, theObject.countWays(3, 3),3LL); } { AlternateColors2 theObject; eq(2, theObject.countWays(6, 4),9LL); } { AlternateColors2 theObject; eq(3, theObject.countWays(6, 1),21LL); } { AlternateColors2 theObject; eq(4, theObject.countWays(1000, 2),1LL); } { AlternateColors2 theObject; eq(5, theObject.countWays(100000, 100000),1666700000LL); } return 0; }
double test5() { int p0 = 100000; int p1 = 100000; AlternateColors2 * obj = new AlternateColors2(); clock_t start = clock(); long long my_answer = obj->countWays(p0, p1); clock_t end = clock(); delete obj; cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl; long long p2 = 1666700000LL; cout <<"Desired answer: " <<endl; cout <<"\t" << p2 <<endl; cout <<"Your answer: " <<endl; cout <<"\t" << my_answer <<endl; if (p2 != my_answer) { cout <<"DOESN'T MATCH!!!!" <<endl <<endl; return -1; } else { cout <<"Match :-)" <<endl <<endl; return (double)(end-start)/CLOCKS_PER_SEC; } }