結果

問題 No.227 簡単ポーカー
ユーザー mm
提出日時 2020-08-02 06:16:01
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 819 bytes
コンパイル時間 899 ms
コンパイル使用メモリ 28,428 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-25 01:11:25
合計ジャッジ時間 1,876 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <stdio.h>

int main(int argc, char *argv[]){
  int a;
  int n[13] = {};

  for (int i = 0; i < 5; i++){
    scanf("%d", &a);
    n[a-1]++;
  }

  char p1 = '0';
  char p2 = '0';
  char p3 = '0';

  for (int i = 0; i < 13; i++){
    if (n[i] == 2) {
      if (p1 == '0') {
        p1 = '1';
      } else {
        p2 = '1';
      }
    }
    if (n[i] == 3) {
      p3 = '1';
    }
  }

  if (p3 == '1' && (p1 == '1' || p2 == '1')) {
    printf("%s\n", "FULL HOUSE");
  }
  if (p3 == '1' && p1 == '0' && p2 == '0') {
    printf("%s\n", "THREE CARD");
  }
  if (p3 == '0' && p1 == '1' && p2 == '1') {
    printf("%s\n", "TWO PAIR");
  }
  if (p3 == '0' && p1 == '1' && p2 == '0') {
    printf("%s\n", "ONE PAIR");
  }
  if (p3 == '0' && p1 == '0' && p2 == '0') {
    printf("%s\n", "NO HAND");
  }

  return 0;
}
0