結果

問題 No.227 簡単ポーカー
コンテスト
ユーザー eilailju
提出日時 2019-03-31 23:11:01
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 5,000 ms
+ 384µs
コード長 965 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 417 ms
コンパイル使用メモリ 96,432 KB
実行使用メモリ 9,904 KB
最終ジャッジ日時 2026-10-11 05:11:05
合計ジャッジ時間 1,755 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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