結果

問題 No.227 簡単ポーカー
ユーザー eilailjueilailju
提出日時 2019-03-31 23:11:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 965 bytes
コンパイル時間 2,287 ms
コンパイル使用メモリ 81,004 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-14 16:40:48
合計ジャッジ時間 2,858 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,384 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,384 KB
testcase_13 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0