結果

問題 No.227 簡単ポーカー
ユーザー ty70ty70
提出日時 2016-11-10 17:11:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 958 bytes
コンパイル時間 3,103 ms
コンパイル使用メモリ 171,024 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-16 17:41:53
合計ジャッジ時間 2,131 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;



enum hand{
	NO_HAND = 0x00,
	FULL_HOUSE = 0x05,
	THREE_CARD = 0x04,
	TWO_PAIR = 0x02,
	ONE_PAIR = 0x01
};

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	map<int,int> cnt; cnt.clear();
	int a[5] = {0};
	rep (i, 5){
		int a; cin >> a;
		++cnt[a];
	} // end rep

	int res = NO_HAND;
	map<int,int>::iterator it = cnt.begin();
	for (; it != cnt.end(); ++it){
		int pairs = (*it).second;
		if (pairs == 2) res += ONE_PAIR;
		if (pairs == 3) res |= THREE_CARD;
	} // end for

	if (res == FULL_HOUSE){
		cout << "FULL HOUSE" << endl;
	}else
	if (res == THREE_CARD){
		cout << "THREE CARD" << endl;
	}else
	if (res == TWO_PAIR){
		cout << "TWO PAIR" << endl;
	}else
	if (res == ONE_PAIR){
		cout << "ONE PAIR" << endl;
	}else{
		cout << "NO HAND" << endl;
	} // end if

	return 0;
}
0