結果

問題 No.227 簡単ポーカー
ユーザー ミドリムシミドリムシ
提出日時 2017-10-14 01:42:09
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 769 bytes
コンパイル時間 556 ms
コンパイル使用メモリ 61,388 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-11 00:51:21
合計ジャッジ時間 1,251 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;
 
int main(){
	int cards[5];
	for(int i = 0; i < 5; i++){
		cin >> cards[i];
	}
	sort(cards, cards + 5);
	int continuity = 1;
	int num = cards[0];
	int card3 = 0, card2 = 0;
	for(int i = 1; i < 5; i++){
		if(cards[i] == num){
			continuity++;
		}else{
			if(continuity == 2){
				card2++;
			}else if(continuity == 3){
				card3++;
			}
			continuity = 1;
			num = cards[i];
		}
	}
	if(continuity == 2){
		card2++;
	}else if(continuity == 3){
		card3++;
	}
	if(card3 && card2){
		cout << "FULL HOUSE" << endl;
	}else if(card3){
		cout << "THREE CARD" << endl;
	}else if(card2 == 2){
		cout << "TWO PAIR" << endl;
	}else if(card2 == 1){
		cout << "ONE PAIR" << endl;
	}else{
		cout << "NO HAND" << endl;
	}
}
0