コード例 #1
0
ファイル: 1_550.cpp プロジェクト: zhangyilin/leetcode
int main(){
	Lottery L;
	vector<string> s;
	s.push_back ("A:100 10 T T");
	s.push_back ("B:20 2 F T");
	string ss[]= {"INDIGO: 93 8 T F","ORANGE: 29 8 F T","VIOLET: 76 6 F F","BLUE: 100 8 T T","RED: 99 8 T T","GREEN: 78 6 F T","YELLOW: 75 6 F F"};
	vector<string> sss(ss,ss+sizeof(ss)/sizeof(string));
	L.sortByOdds(sss);
	cout<< 1- (double)(factorial(90,10)+10*factorial(90,9))/factorial(100,10)<< endl;
	cout<< (double)factorial(10,2)*factorial(98,8)/factorial(100,10)<<endl;
	cout<< factorial(5,2)<<endl;
}
コード例 #2
0
ファイル: Lottery.cpp プロジェクト: yuki252111/-Millionaire
Lottery* Lottery::createLottery(int numbers, int width, int height, float CardSpriteX, float CardSpriteY)
{
	Lottery* lotteryInstance = new Lottery();
	if (lotteryInstance && lotteryInstance->init())
	{
		lotteryInstance->autorelease();
		lotteryInstance->lotteryInit(numbers, width, height, CardSpriteX, CardSpriteY);

		return lotteryInstance;
	}

	CC_SAFE_DELETE(lotteryInstance);
	return NULL;
}
コード例 #3
0
ファイル: LotteryTest.cpp プロジェクト: yash0101/TopCoder
 void testCase1() {
     string rules_[] = {"INDIGO: 93 8 T F", "ORANGE: 29 8 F T", "VIOLET: 76 6 F F", "BLUE: 100 8 T T", "RED: 99 8 T T", "GREEN: 78 6 F T", "YELLOW: 75 6 F F"};
     vector<string> rules(rules_, rules_ + (sizeof(rules_) / sizeof(rules_[0])));
     string expected__[] = {"RED", "ORANGE", "YELLOW", "GREEN", "BLUE", "INDIGO", "VIOLET"};
     vector<string> expected_(expected__, expected__ + (sizeof(expected__) / sizeof(expected__[0])));
     assertEquals(1, expected_, solution.sortByOdds(rules));
 }
コード例 #4
0
ファイル: LotteryTest.cpp プロジェクト: yash0101/TopCoder
 void testCase0() {
     string rules_[] = {"PICK ANY TWO: 10 2 F F", "PICK TWO IN ORDER: 10 2 T F", "PICK TWO DIFFERENT: 10 2 F T", "PICK TWO LIMITED: 10 2 T T"};
     vector<string> rules(rules_, rules_ + (sizeof(rules_) / sizeof(rules_[0])));
     string expected__[] = {"PICK TWO LIMITED", "PICK TWO IN ORDER", "PICK TWO DIFFERENT", "PICK ANY TWO"};
     vector<string> expected_(expected__, expected__ + (sizeof(expected__) / sizeof(expected__[0])));
     assertEquals(0, expected_, solution.sortByOdds(rules));
 }
コード例 #5
0
ファイル: Lottery.cpp プロジェクト: beknazar/problems
bool do_test(vector<string> rules, vector<string> __expected) {
    time_t startClock = clock();
    Lottery *instance = new Lottery();
    vector<string> __result = instance->sortByOdds(rules);
    double elapsed = (double)(clock() - startClock) / CLOCKS_PER_SEC;
    delete instance;

    if (__result == __expected) {
        cout << "PASSED!" << " (" << elapsed << " seconds)" << endl;
        return true;
    }
    else {
        cout << "FAILED!" << " (" << elapsed << " seconds)" << endl;
        cout << "           Expected: " << to_string(__expected) << endl;
        cout << "           Received: " << to_string(__result) << endl;
        return false;
    }
}
コード例 #6
0
ファイル: main.cpp プロジェクト: guwensen/Lottery
VOID CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime)
{
#if 0
	if (gd->lottery()) {
		submitLottery(gd);
		//showDebugInfo(gd);
	}

	if (ssc->lottery()) {
		submitLottery(ssc);
		//showDebugInfo(ssc);
	}
#endif
	for (unsigned int i = 0; i < lotterys.size(); ++i) {
		Lottery* lottery = lotterys[i];
		if (lottery->lottery()) {
			//showDebugInfo(lotterys[i]);
			submitLottery(lotterys[i]);
		}
	}
}
コード例 #7
0
ファイル: main.cpp プロジェクト: vladfau/ssu
int main(void)
{
    ifstream in("/Users/masha/Documents/ssu/PrVecList19B/PrVecList19B/input");
    Lottery *l = new Lottery();
    
    
    int x,y;
    cout << "Enter number of ticket for move ";
    cin >> x;
    cout << "Enter number of ticket for show ";
    cin >> y;
    
    int number;
    string symbol;
    while(in >> number >> symbol) l->add(new Ticket(number, symbol));
    l->describe();
    l->move(x);
    l->describe();
    l->show(y);
    
}
コード例 #8
0
ファイル: LotteryTest.cpp プロジェクト: yash0101/TopCoder
 void testCase2() {
     vector<string> rules;
     vector<string> expected_;
     assertEquals(2, expected_, solution.sortByOdds(rules));
 }