結果

問題 No.227 簡単ポーカー
ユーザー Maeda
提出日時 2025-03-28 14:04:22
言語 C
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 876 bytes
コンパイル時間 402 ms
コンパイル使用メモリ 25,472 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-28 14:04:25
合計ジャッジ時間 1,449 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other RE * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf("%d",&card);
      |         ^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

void main(void) {
    int trump[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0};
    int card = 0;
    for(int i = 0 ; i < 5 ; i++){
        int card = 0;
        scanf("%d",&card);
        trump[card-1]++;
    }
    int countPAIR = 0,countCARD = 0;
    
    for(int i = 0 ; i < 13 ; i++){
        if(trump[i] < 2 || trump[i] > 3){
            continue;
        }
        if(trump[i] == 3){
            countCARD++;
        }else if(trump[i] == 2){
            countPAIR++;
        }
        if(countCARD == 1 && countCARD == 1 || countPAIR == 2){
        	break;
    	}
    }
    if(countPAIR == 1 && countCARD == 1){
        printf("FULL HOUSE");
    }else if(countCARD == 1){
        printf("THREE CARD");
    }else if(countPAIR == 2){
        printf("TWO PAIR");
    }else if(countPAIR == 1){
        printf("ONE PAIR");
    }else{
        printf("NO HAND");
    }
}
0