結果

問題 No.227 簡単ポーカー
ユーザー masakiGitmasakiGit
提出日時 2018-06-14 23:58:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 892 bytes
コンパイル時間 506 ms
コンパイル使用メモリ 64,940 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-13 04:25:01
合計ジャッジ時間 1,250 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>
#include <iostream>
using namespace std;

int main(void) {
	int s[5];
	cin >> s[0] >> s[1] >> s[2] >> s[3] >> s[4];
	int box[14];
	//boxの0クリア
	for (int i = 0; i < 14; i++) {
		box[i] = 0;
	}
	//入力値をboxにカウントアップ
	//入力数値をそのまま配列の引数にするので13が溢れてしまうのでboxは14にする
	for (int i = 0; i < 5; i++) {
		box[s[i]]++;
	}
	int cntThree, cntTwo;
	cntThree = 0;
	cntTwo = 0;
	for (int i = 0; i < 14; i++)
	{
		if (box[i] == 3) {
			cntThree++;
		}
		else if (box[i] == 2) {
			cntTwo++;
		}
	}
	if (cntThree == 1 && cntTwo == 1) {
		cout << "FULL HOUSE" << endl;
	}
	else if (cntThree == 1) {
		cout << "THREE CARD" << endl;
	}

	else if (cntTwo == 2) {
		cout << "TWO PAIR" << endl;
	}

	else if (cntTwo == 1) {
		cout << "ONE PAIR" << endl;
	}
	else {
		cout << "NO HAND" << endl;
	}
	return 0;
}
0