コード例 #1
0
double test1() {
	int t0[] = {1, 2, 3};
	vector <int> p0(t0, t0+sizeof(t0)/sizeof(int));
	SlimeXSlimesCity * obj = new SlimeXSlimesCity();
	clock_t start = clock();
	int my_answer = obj->merge(p0);
	clock_t end = clock();
	delete obj;
	cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl;
	int p1 = 2;
	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;
	}
}
コード例 #2
0
// BEGIN CUT HERE
int main( int argc, char* argv[] ) {
    {
        int populationARRAY[] = {2, 3, 4};
        vector <int> population( populationARRAY, populationARRAY+ARRSIZE(populationARRAY) );
        SlimeXSlimesCity theObject;
        eq(0, theObject.merge(population),2);
    }
    {
        int populationARRAY[] = {1, 2, 3};
        vector <int> population( populationARRAY, populationARRAY+ARRSIZE(populationARRAY) );
        SlimeXSlimesCity theObject;
        eq(1, theObject.merge(population),2);
    }
    {
        int populationARRAY[] = {8,2,3,8};
        vector <int> population( populationARRAY, populationARRAY+ARRSIZE(populationARRAY) );
        SlimeXSlimesCity theObject;
        eq(2, theObject.merge(population),2);
    }
    {
        int populationARRAY[] = {1000000000, 999999999, 999999998, 999999997};
        vector <int> population( populationARRAY, populationARRAY+ARRSIZE(populationARRAY) );
        SlimeXSlimesCity theObject;
        eq(3, theObject.merge(population),3);
    }
    {
        int populationARRAY[] = {1,1,1};
        vector <int> population( populationARRAY, populationARRAY+ARRSIZE(populationARRAY) );
        SlimeXSlimesCity theObject;
        eq(4, theObject.merge(population),3);
    }
    {
        int populationARRAY[] = {1, 2, 4, 6, 14, 16, 20};
        vector <int> population( populationARRAY, populationARRAY+ARRSIZE(populationARRAY) );
        SlimeXSlimesCity theObject;
        eq(5, theObject.merge(population),3);
    }
}