結果
| 問題 |
No.227 簡単ポーカー
|
| コンテスト | |
| ユーザー |
ty70
|
| 提出日時 | 2016-11-10 17:11:04 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 958 bytes |
| コンパイル時間 | 1,801 ms |
| コンパイル使用メモリ | 173,216 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-25 07:19:10 |
| 合計ジャッジ時間 | 2,154 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
enum hand{
NO_HAND = 0x00,
FULL_HOUSE = 0x05,
THREE_CARD = 0x04,
TWO_PAIR = 0x02,
ONE_PAIR = 0x01
};
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
map<int,int> cnt; cnt.clear();
int a[5] = {0};
rep (i, 5){
int a; cin >> a;
++cnt[a];
} // end rep
int res = NO_HAND;
map<int,int>::iterator it = cnt.begin();
for (; it != cnt.end(); ++it){
int pairs = (*it).second;
if (pairs == 2) res += ONE_PAIR;
if (pairs == 3) res |= THREE_CARD;
} // end for
if (res == FULL_HOUSE){
cout << "FULL HOUSE" << endl;
}else
if (res == THREE_CARD){
cout << "THREE CARD" << endl;
}else
if (res == TWO_PAIR){
cout << "TWO PAIR" << endl;
}else
if (res == ONE_PAIR){
cout << "ONE PAIR" << endl;
}else{
cout << "NO HAND" << endl;
} // end if
return 0;
}
ty70