結果

問題 No.227 簡単ポーカー
ユーザー ebicochinealebicochineal
提出日時 2016-10-20 13:56:09
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,855 bytes
コンパイル時間 1,221 ms
コンパイル使用メモリ 82,388 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-02 20:29:22
合計ジャッジ時間 1,556 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <map>
#include <vector>
#include <algorithm>
#include <iostream>
#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(a) (a).begin(),(a).end()
typedef long long int LLI;
typedef unsigned long long int ULLI;
using namespace std;

string replace5126(string str, string old_s, string new_s) {
    int i;
    if (old_s == "") { return str; }
    while ((i = str.find(old_s)) > -1) { str.replace(i, old_s.size(), new_s); }
    return str;
}

int count5126(string str, string a) {
    int i = 0, cnt = 0;
    if (a == "") { return -1; }
    while ((i = str.find(a, i)) > -1) { ++cnt; i += a.size(); }
    return cnt;
}

vector<string> split5126(string str, string sep){
    int s = 0, p = 0;
    vector<string> v;
    if (sep == "") {
        v.push_back(str);
        return v;
    }
    while ((p = str.find(sep, s)) > -1) {
        v.push_back(str.substr(s, p - s));
        s = p + sep.size();
    }
    v.push_back(str.substr(s, str.size()));
    return v;
}

string slice5126(string str, int a, int b){
    int s = a < 0 ? str.size() + a : a;
    int e = b < 0 ? str.size() + b : b;
    e = b == 0 ? str.size() : e;
    return str.substr(s, (s > e ? s : e) - s);
}

int main() {
    map<int, int> mp;
    vector<int> v;
    for (int i = 0; i < 5; ++i){
        int j; cin >> j;
        mp[j] = mp.count(j) == 0 ? 0 : mp[j] + 1;
    }
    for (auto i = mp.begin(); i != mp.end(); ++i) {
        v.push_back(i->second);
    }
    sort(ALL(v));
    if (v.size() == 2 && v[0] > 1) {
        cout << "FULL HOUSE" << endl;
    } else if (v.size() == 3 && v[1] == 2 && v[2] == 2) {
        cout << "TWO PAIR" << endl;
    } else if (v[v.size()-1] == 2 && v[v.size()-2] == 1) {
        cout << "ONE PAIR" << endl;
    } else if (v[v.size()-1] == 3){
        cout << "THREE CARD" << endl;
    } else {
        cout << "NO HAND" << endl;
    }
    return 0;
}
0