結果

問題 No.227 簡単ポーカー
ユーザー pyraninepyranine
提出日時 2020-12-15 01:02:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 523 bytes
コンパイル時間 1,875 ms
コンパイル使用メモリ 166,896 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 05:32:59
合計ジャッジ時間 2,111 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:7:17: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
    7 |   char *s[5] = {"NO HAND", "FULL HOUSE", "THREE CARD", "TWO PAIR", "ONE PAIR"};
      |                 ^~~~~~~~~
main.cpp:7:28: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
    7 |   char *s[5] = {"NO HAND", "FULL HOUSE", "THREE CARD", "TWO PAIR", "ONE PAIR"};
      |                            ^~~~~~~~~~~~
main.cpp:7:42: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
    7 |   char *s[5] = {"NO HAND", "FULL HOUSE", "THREE CARD", "TWO PAIR", "ONE PAIR"};
      |                                          ^~~~~~~~~~~~
main.cpp:7:56: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
    7 |   char *s[5] = {"NO HAND", "FULL HOUSE", "THREE CARD", "TWO PAIR", "ONE PAIR"};
      |                                                        ^~~~~~~~~~
main.cpp:7:68: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
    7 |   char *s[5] = {"NO HAND", "FULL HOUSE", "THREE CARD", "TWO PAIR", "ONE PAIR"};
      |                                                                    ^~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  int memo[13];
  int i, a[5];
  char *s[5] = {"NO HAND", "FULL HOUSE", "THREE CARD", "TWO PAIR", "ONE PAIR"};
  for (i = 0; i < 5; i++) {
    scanf("%d", &a[i]);
    memo[a[i] - 1]++;
  }
  int c = 0, d = 0;
  for (i = 0; i < 13; i++) {
    c += (memo[i] == 2);
    d += (memo[i] == 3);
  }
  int ans = 0;
  if (c == 1 && d == 1) ans = 1;
  else if (d == 1) ans = 2;
  else if (c == 2) ans = 3;
  else if (c == 1) ans = 4;
  printf("%s\n", s[ans]);
  return 0;
}
0