結果

問題 No.227 簡単ポーカー
ユーザー gemy
提出日時 2023-11-21 07:51:36
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 651 bytes
コンパイル時間 1,973 ms
コンパイル使用メモリ 198,348 KB
最終ジャッジ日時 2025-02-17 22:40:50
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int main() {
    // Input
    int A[5];
    rep(i, 5) cin >> A[i];

    // Judge
    vector<int> cnt(14);
    rep(i, 5) ++cnt[A[i]];
    sort(cnt.begin(), cnt.end());
    string hand;
    rep(i, 13) if (cnt[i + 1] != 0) hand += to_string(cnt[i + 1]);

    // Output
    if (hand == "23") cout << "FULL HOUSE" << endl;
    else if (hand == "113") cout << "THREE CARD" << endl;
    else if (hand == "122") cout << "TWO PAIR" << endl;
    else if (hand == "1112") cout << "ONE PAIR" << endl;
    else cout << "NO HAND" << endl;
}
0