結果
| 問題 |
No.227 簡単ポーカー
|
| コンテスト | |
| ユーザー |
ebicochineal
|
| 提出日時 | 2016-10-20 13:56:09 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,855 bytes |
| コンパイル時間 | 1,501 ms |
| コンパイル使用メモリ | 82,036 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-23 14:42:17 |
| 合計ジャッジ時間 | 2,112 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 WA * 11 |
ソースコード
#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;
}
ebicochineal