コード例 #1
0
// BEGIN CUT HERE
void main( int argc, char* argv[] ) {
    {
        int strengthARRAY[] = {230988, 692473, 829904, 810585, 841281, 869742, 205319, 182994, 745583, 710632, 364907, 150624, 131777, 393757, 983482};
        vector <int> strength( strengthARRAY, strengthARRAY+ARRSIZE(strengthARRAY) );
        TeamContest theObject;
        eq(0, theObject.worstRank(strength),4);
    }
    {
        int strengthARRAY[] = {728935, 126966, 196117, 70933, 652538, 230031, 220008, 170949, 207149, 748007, 156919, 368745, 750029, 485044, 640194, 40651, 631911, 446187, 692659, 483043, 525705, 661121, 632025, 309374, 526758, 5873, 683669, 768970, 258119, 414688, 203321, 54599, 632996, 572509, 686361, 396855, 310078, 596968, 799631}
           ;
        vector <int> strength( strengthARRAY, strengthARRAY+ARRSIZE(strengthARRAY) );
        TeamContest theObject;
        eq(1, theObject.worstRank(strength),12);
    }
    {
        int strengthARRAY[] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
        vector <int> strength( strengthARRAY, strengthARRAY+ARRSIZE(strengthARRAY) );
        TeamContest theObject;
        eq(2, theObject.worstRank(strength),1);
    }
    {
        int strengthARRAY[] = {3,9,4,6,2,6,1,6,9,1,4,1,3,8,5}
           ;
        vector <int> strength( strengthARRAY, strengthARRAY+ARRSIZE(strengthARRAY) );
        TeamContest theObject;
        eq(3, theObject.worstRank(strength),3);
    }
    {
        int strengthARRAY[] = {53,47,88,79,99,75,28,54,65,14,22,13,11,31,43}
           ;
        vector <int> strength( strengthARRAY, strengthARRAY+ARRSIZE(strengthARRAY) );
        TeamContest theObject;
        eq(4, theObject.worstRank(strength),3);
    }
}
コード例 #2
0
ファイル: TeamContest.cpp プロジェクト: tracyhenry/TopCoder
bool KawigiEdit_RunTest(int testNum, vector <int> p0, bool hasAnswer, int p1) {
	cout << "Test " << testNum << ": [" << "{";
	for (int i = 0; int(p0.size()) > i; ++i) {
		if (i > 0) {
			cout << ",";
		}
		cout << p0[i];
	}
	cout << "}";
	cout << "]" << endl;
	TeamContest *obj;
	int answer;
	obj = new TeamContest();
	clock_t startTime = clock();
	answer = obj->worstRank(p0);
	clock_t endTime = clock();
	delete obj;
	bool res;
	res = true;
	cout << "Time: " << double(endTime - startTime) / CLOCKS_PER_SEC << " seconds" << endl;
	if (hasAnswer) {
		cout << "Desired answer:" << endl;
		cout << "\t" << p1 << endl;
	}
	cout << "Your answer:" << endl;
	cout << "\t" << answer << endl;
	if (hasAnswer) {
		res = answer == p1;
	}
	if (!res) {
		cout << "DOESN'T MATCH!!!!" << endl;
	} else if (double(endTime - startTime) / CLOCKS_PER_SEC >= 2) {
		cout << "FAIL the timeout" << endl;
		res = false;
	} else if (hasAnswer) {
		cout << "Match :-)" << endl;
	} else {
		cout << "OK, but is it right?" << endl;
	}
	cout << "" << endl;
	return res;
}
コード例 #3
0
int main () {
	std::ios_base::sync_with_stdio(false);
	TeamContest teamContest;
	cout << teamContest.worstRank(vector <int>({5, 7, 3, 5, 7, 3, 5, 7, 3}));
	return 0;
}