結果

問題 No.227 簡単ポーカー
ユーザー pekempeypekempey
提出日時 2015-06-19 22:27:04
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,164 bytes
コンパイル時間 1,258 ms
コンパイル使用メモリ 153,096 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-21 09:56:21
合計ジャッジ時間 1,923 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrep2(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define all(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll inf = 1e9;
const ll mod = 1e9 + 7;

int a[5];
int num[14];
int solve() {
    map<int, int> m;

    rep (i, 5) m[a[i]]++;

    if (m.size() == 2) {
        if (m[a[0]] == 3 || m[a[0]] == 2) {
            return 0;
        }
    }

    for (auto p : m) {
        if (p.second == 3) return 1;
    }

    rep (i, 5) num[a[i]]++;

    int cnt = 0;

    rep (i, 14) {
        if (num[i] == 2) cnt++;
    }

    if (cnt == 2) return 2;
    else if (cnt == 1) return 3;

    return 4;
}

int main() {
    rep (i, 5) cin >> a[i];

    sort(a, a + 5);

    switch (solve()) {
        case 0: cout << "FULL HOUSE" << endl; break;
        case 1: cout << "THREE CARD" << endl; break;
        case 2: cout << "TWO PAIR" << endl; break;
        case 3: cout << "ONE PAIR" << endl; break;
        default: cout << "NO HAND" << endl; break;
    }
}
0