結果

問題 No.227 簡単ポーカー
ユーザー matsuyoshi30
提出日時 2016-02-11 19:07:00
言語 Java
(openjdk 23)
結果
AC  
実行時間 136 ms / 5,000 ms
コード長 1,023 bytes
コンパイル時間 2,112 ms
コンパイル使用メモリ 74,456 KB
実行使用メモリ 41,232 KB
最終ジャッジ日時 2024-09-22 00:44:05
合計ジャッジ時間 4,780 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Main {
    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        int[] cards = new int[13];
        for(int i=0; i<5; i++) {
            cards[in.nextInt() - 1]++;
        }
        in.close();

        int hand = 0;
        for(int i=0; i<cards.length; i++) {
            if(cards[i] == 2) {
                hand++;
            } else if(cards[i] == 3) {
                hand += 10;
            }
        }

        String handName = "";
        switch(hand) {
            case 1:
                handName = "ONE PAIR";
                break;
            case 2:
                handName = "TWO PAIR";
                break;
            case 10:
                handName = "THREE CARD";
                break;
            case 11:
                handName = "FULL HOUSE";
                break;
            default:
                handName = "NO HAND";
                break;
        }
        System.out.println(handName);
    }
}
0