結果

問題 No.227 簡単ポーカー
ユーザー tnakao0123tnakao0123
提出日時 2016-03-28 18:13:54
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,116 bytes
コンパイル時間 567 ms
コンパイル使用メモリ 84,764 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-10 05:07:34
合計ジャッジ時間 1,240 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 227.cc: No.227 簡単ポーカー - yukicoder
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int N = 5;
const int C = 13;

/* typedef */

/* global variables */

int cs[C];

/* subroutines */

/* main */

int main() {
  int maxc0 = 0, maxc1 = 0;
  for (int i = 0; i < N; i++) {
    int ai;
    cin >> ai;
    cs[--ai]++;
  }

  for (int i = 0; i < C; i++) {
    if (maxc0 <= cs[i]) maxc1 = maxc0, maxc0 = cs[i];
    else if (maxc1 < cs[i]) maxc1 = cs[i];
  }
  //printf("maxc0=%d, maxc1=%d\n", maxc0, maxc1);

  string ans;
  if (maxc0 == 3) {
    if (maxc1 == 2) ans = "FULL HOUSE";
    else ans = "THREE CARD";
  }
  else if (maxc0 == 2) {
    if (maxc1 == 2) ans = "TWO PAIR";
    else ans = "ONE PAIR";
  }
  else ans = "NO HAND";

  cout << ans << endl;
  return 0;
}
0