結果
| 問題 | No.227 簡単ポーカー | 
| コンテスト | |
| ユーザー |  eilailju | 
| 提出日時 | 2019-03-31 23:11:01 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 965 bytes | 
| コンパイル時間 | 652 ms | 
| コンパイル使用メモリ | 77,192 KB | 
| 最終ジャッジ日時 | 2025-01-07 00:41:41 | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 14 | 
ソースコード
#include <iostream>
#include <map>
using namespace std;
map<int, int> input;
int main() {
	//Count duplicated number
	int tmpIn = 0;	
	for (size_t i = 0; i < 5; i++)
	{
		cin >> tmpIn;
		input[tmpIn]++;
	}
	//Count number of 2 or 3 set card
	int twoSetCnt = 0, threeSetCnt = 0;
	for (auto target : input) {
		if (target.second == 2) {
			twoSetCnt++;
			continue;
		}
		if (target.second == 3) {
			threeSetCnt++;
		}
	}
#pragma region JudgeHand
	//FULL HOUSE
	if (threeSetCnt == 1 && twoSetCnt == 1) {
		cout << "FULL HOUSE" << "\n";
	}
	//THREE CARD
	else if (threeSetCnt == 1) {
		cout << "THREE CARD" << "\n";
	}
	//TWO PAIR
	else if (twoSetCnt == 2) {
		cout << "TWO PAIR" << "\n";
	}
	//ONE PAIR
	else if (twoSetCnt == 1) {
		cout << "ONE PAIR" << "\n";
	}
	else 
	{
		//NOT MATCH
		cout << "NO HAND" << "\n";
	}
#pragma endregion
#ifdef _DEBUG
	system("pause");
#endif // DEBUG
	return 0;
}
            
            
            
        