結果

問題 No.227 簡単ポーカー
ユーザー cympfhcympfh
提出日時 2015-08-15 16:35:35
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 2,089 bytes
コンパイル時間 2,004 ms
コンパイル使用メモリ 145,948 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-25 12:08:17
合計ジャッジ時間 2,099 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘bool fourcard(vi&)’:
main.cpp:46:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
main.cpp: In function ‘bool three(vi&)’:
main.cpp:57:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define loop for(;;)
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;
#define inf (1e9)
#define eps (1e-9)
 
template<class S, class T> inline
ostream& operator<<(ostream&os, pair<S,T> p) {
  return os << '(' << p.first << ", " << p.second << ')';
}
 
template<class S, class T, class U> inline
ostream& operator<<(ostream&os, tuple<S,T,U> t) {
  return os << '('
    << get<0>(t) << ", "
    << get<1>(t) << ", "
    << get<2>(t) << ')';
}
 
template<class T> inline
ostream& operator<<(ostream&os, vector<T> v) {
  if (v.size() == 0) { return os << "(empty)"; }
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}
 
template<class T> inline
istream& operator>>(istream&is, vector<T>&v) {
  rep (i, v.size()) is >> v[i];
  return is;
}
 
//           ^   >  v   <
int dx[] = { -1, 0, 1,  0 };
int dy[] = {  0, 1, 0, -1 };
 
typedef vector<int> vi;
int memo[20];
 
bool fourcard(vi&xs) {
  rep (i, 20) if (memo[i] == 4) return true;
}


bool fullhouse(vi&xs) {
  bool a = false, b = false;
  rep (i, 20) if (memo[i] == 2) a = true; else if (memo[i] == 3) b = true;
  return a and b;
}
 
bool three(vi&xs) {
  rep (i, 20) if (memo[i] == 3) return true;
}
 
bool two(vi&xs) {
  int m = 0;
  rep (i,20) if (memo[i] == 2) ++m;
  return m == 2;
}
 
bool one(vi&xs) {
  int m = 0;
  rep (i,20) if (memo[i] == 2) ++m;
  return m == 1;
}
 
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout.setf(ios::fixed);
  cout.precision(10);
 
  int a,b,c,d,e;
  while (cin>>a >>b >>c >>d >>e) {
    vi xs = {a,b,c,d,e};
    rep (i, 20) memo[i] = 0;
    for (int x: xs) memo[x]++;
    if (fourcard(xs)) {
      cout << "FOUR CARD" << endl;
    } else if (fullhouse(xs)) {
      cout << "FULL HOUSE" << endl;
    } else if (three(xs)) {
      cout << "THREE CARD" << endl;
    } else if (two(xs)) {
      cout << "TWO PAIR" << endl;
    } else if (one(xs)) {
      cout << "ONE PAIR" << endl;
    } else {
      cout << "NO HAND" << endl;
    }
  }
 
  return 0;
}
0