結果

問題 No.227 簡単ポーカー
ユーザー mitsuwarmitsuwar
提出日時 2019-08-24 17:29:04
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 931 bytes
コンパイル時間 1,361 ms
コンパイル使用メモリ 162,792 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-22 13:31:28
合計ジャッジ時間 1,924 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include "bits/stdc++.h"

#define SORT(vec) sort(vec.begin(), vec.end());


using namespace std;
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
//  --------------------------------------

	vector<int> A;

	for (int i = 0; i < 5; i++)
	{
		int a;
		cin >> a;
		A.push_back(a);
	}
	
	SORT(A);

	int hand[2] = {0};
	int j = 0;
	for (int i = 0; i < 4; i++)
	{
		if (A[i] == A[i+1])
		{
			hand[j] += 1;
		}else if (hand[j] != 0 && A[i] != A[i+1]){
			j = 1;
		}

		// cout << hand[0] << " " << hand[1] << "\n";
		
	}

	string ans;
	switch (hand[0])
	{
	case 1:
		switch (hand[1])
		{
		case 0:
			ans = "ONE PAIR";
			break;

		case 1:
			ans = "TWO PAIR";
			break;

		case 2:
			ans = "FULL HOUSE";
			break;
		}
		break;

	case 2:
		switch (hand[1])
		{
		case 0:
			ans = "THREE CARD";
			break;

		case 1:
			ans = "FULL HOUSE";
			break;
		}
		break;
	default:
		ans = "NO HAND";
		break;
	}
	
	cout << ans << "\n";
}
0