結果
| 問題 |
No.227 簡単ポーカー
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-01 22:58:23 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 1,384 bytes |
| コンパイル時間 | 1,818 ms |
| コンパイル使用メモリ | 172,860 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-14 14:51:18 |
| 合計ジャッジ時間 | 2,418 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n, m) for (ll i = n; i < (ll)(m); i++)
#define _rep(i, n, m) for (ll i = n; i <= (ll)(m); i++)
using ll = long long;
const string fh = "FULL HOUSE";
const string threec = "THREE CARD";
const string twop = "TWO PAIR";
const string onep = "ONE PAIR";
const string nh = "NO HAND";
int main() {
// 5 cards
// 1 to 13
// full house a a a b b
// three card a a a x
// two pair a a b b x
// one pair a a x x x
vector<int> c(5);
rep(i, 0, 5) cin >> c.at(i);
sort(c.begin(), c.end());
vector<int> cnum(5, 0);
_rep(i, 0, 4) {
_rep(j, 0, 4) {
if (c[i] == c[j]) cnum[i]++;
}
}
// a,a,a,b,b
// a,a,b,b,b
// 2 2 3 3 3
// x,x,a,a,a
// x,a,a,a,x
// x,x,a,a,a
// 1,1,3,3,3
// x,a,a,b,b
// a,a,x,b,b
// a,a,b,b,x
// 1,2,2,2,2
// x,x,x,a,a
// a,a,x,x,x
// 1,1,1,2,2
sort(cnum.begin(), cnum.end());
if (cnum[0] == 2 and cnum[1] == 2 and cnum[2] == 3)
cout << fh << endl;
else if (cnum[0] == 1 and cnum[1] == 1 and cnum[2] == 3)
cout << threec << endl;
else if (cnum[0] == 1 and cnum[1] == 2 and cnum[3] == 2)
cout << twop << endl;
else if (cnum[0] == 1 and cnum[1] == 1 and cnum[3] == 2)
cout << onep << endl;
else
cout << nh << endl;
}