結果
| 問題 | No.227 簡単ポーカー | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2022-05-21 17:02:07 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 1,134 bytes | 
| コンパイル時間 | 971 ms | 
| コンパイル使用メモリ | 78,440 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-09-20 11:59:44 | 
| 合計ジャッジ時間 | 1,500 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 14 | 
ソースコード
#include <iostream>		//cin, cout
#include <vector>		//vector
#include <algorithm>	//sort,min,max,count
#include <string>		//string,getline, to_string
#include <cstdlib>		//abs(int)
#include <utility>		//swap, pair
#include <deque>		//deque
#include <climits>		//INT_MAX
#include <bitset>		//bitset
using namespace std;
int main() {
	vector<int> A(5);
	cin >> A[0] >> A[1] >> A[2] >> A[3] >> A[4];
	sort(A.begin(), A.end());
	vector<int> S;
	int cnt = 0;
	for (int i = 0; i < 4; i++) {
		if (A[i] != A[i + 1]) {
			cnt++;
			S.push_back(i);
		}
	}
	switch (cnt) {
	case 4: cout << "NO HAND" << endl; return 0;
	case 3: cout << "ONE PAIR" << endl; return 0;
	case 2:
		switch (S[0]) {
		case 2: cout << "THREE CARD" << endl; return 0;
		case 1: cout << "TWO PAIR" << endl; return 0;
		case 0:
			if (S[1] == 2) {
				cout << "TWO PAIR" << endl; return 0;
			}
			else {
				cout << "THREE CARD" << endl; return 0;
			}
		}
	case 1:
		if (S[0] == 3 || S[0] == 0) {
			cout << "NO HAND" << endl; return 0;
		}
		else {
			cout << "FULL HOUSE" << endl; return 0;
		}
	case 0: cout << "NO HAND" << endl; return 0;
	}
	return 0;
}
            
            
            
        