示例#1
0
文件: main.cpp 项目: jpbirdy/poj
double test0() {
	int t0[] = {3,5};
	vector <int> p0(t0, t0+sizeof(t0)/sizeof(int));
	int t1[] = {0,0};
	vector <int> p1(t1, t1+sizeof(t1)/sizeof(int));
	int p2 = 1;
	WolfPackDivTwo * obj = new WolfPackDivTwo();
	clock_t start = clock();
	int my_answer = obj->calc(p0, p1, p2);
	clock_t end = clock();
	delete obj;
	cout <<"Time: " <<(double)(end-start)/CLOCKS_PER_SEC <<" seconds" <<endl;
	int p3 = 1;
	cout <<"Desired answer: " <<endl;
	cout <<"\t" << p3 <<endl;
	cout <<"Your answer: " <<endl;
	cout <<"\t" << my_answer <<endl;
	if (p3 != 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
void main( int argc, char* argv[] ) {
	{
		int xARRAY[] = {3,5};
		vector <int> x( xARRAY, xARRAY+ARRSIZE(xARRAY) );
		int yARRAY[] = {0,0};
		vector <int> y( yARRAY, yARRAY+ARRSIZE(yARRAY) );
		WolfPackDivTwo theObject;
		eq(0, theObject.calc(x, y, 1),1);
	}
	{
		int xARRAY[] = {0,1};
		vector <int> x( xARRAY, xARRAY+ARRSIZE(xARRAY) );
		int yARRAY[] = {0,0};
		vector <int> y( yARRAY, yARRAY+ARRSIZE(yARRAY) );
		WolfPackDivTwo theObject;
		eq(1, theObject.calc(x, y, 1),0);
	}
	{
		int xARRAY[] = {0,2,4};
		vector <int> x( xARRAY, xARRAY+ARRSIZE(xARRAY) );
		int yARRAY[] = {0,0,0};
		vector <int> y( yARRAY, yARRAY+ARRSIZE(yARRAY) );
		WolfPackDivTwo theObject;
		eq(2, theObject.calc(x, y, 2),4);
	}
	{
		int xARRAY[] = {7,8};
		vector <int> x( xARRAY, xARRAY+ARRSIZE(xARRAY) );
		int yARRAY[] = {8,7};
		vector <int> y( yARRAY, yARRAY+ARRSIZE(yARRAY) );
		WolfPackDivTwo theObject;
		eq(3, theObject.calc(x, y, 1),2);
	}
	{
		int xARRAY[] = {0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,4,4,4,4,4,4,4,4,4,4,6,6,6,6,6,6,6,6,6,6,8,8,8,8,8,8,8,8,8,8}
		;
		vector <int> x( xARRAY, xARRAY+ARRSIZE(xARRAY) );
		int yARRAY[] = {0,2,4,6,8,10,12,14,16,18,0,2,4,6,8,10,12,14,16,18,0,2,4,6,8,10,12,14,16,18,0,2,4,6,8,10,12,14,16,18,0,2,4,6,8,10,12,14,16,18}
		;
		vector <int> y( yARRAY, yARRAY+ARRSIZE(yARRAY) );
		WolfPackDivTwo theObject;
		eq(4, theObject.calc(x, y, 12),0);
	}
	{
		int xARRAY[] = {0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,4,4,4,4,4,4,4,4,4,4,6,6,6,6,6,6,6,6,6,6,8,8,8,8,8,8,8,8,8,8}
		;
		vector <int> x( xARRAY, xARRAY+ARRSIZE(xARRAY) );
		int yARRAY[] = {0,2,4,6,8,10,12,14,16,18,0,2,4,6,8,10,12,14,16,18,0,2,4,6,8,10,12,14,16,18,0,2,4,6,8,10,12,14,16,18,0,2,4,6,8,10,12,14,16,18}
		;
		vector <int> y( yARRAY, yARRAY+ARRSIZE(yARRAY) );
		WolfPackDivTwo theObject;
		eq(5, theObject.calc(x, y, 31),573748580);
	}
}