結果

問題 No.227 簡単ポーカー
ユーザー githide3
提出日時 2018-09-01 16:26:17
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 822 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 28,800 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-18 23:49:57
合計ジャッジ時間 955 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include    <stdio.h>

int main(void)
{
    int A[5];
    int N[14] = {};
    int i;
    int two, three;

    scanf("%d%d%d%d%d", &A[0], &A[1], &A[2], &A[3], &A[4]);

    for (i = 0; i < 5; i++) {
        N[A[i]]++;
    }

    two = three = 0;
    for (i = 1; i < 14; i++) {
        switch (N[i]) {
          case 2:
            two++;
            break;
          case 3:
            three++;
            break;
          default:
            break;
        }
    }

    if (three) {
        if (two) {
            printf("FULL HOUSE\n");
        } else {
            printf("THREE CARD\n");
        }
    } else {
        if (two == 2) {
            printf("TWO PAIR\n");
        } else if (two == 1) {
            printf("ONE PAIR\n");
        } else {
            printf("NO HAND\n");
        }
    }

    return 0;
}
0