結果

問題 No.227 簡単ポーカー
ユーザー matsuyoshi30matsuyoshi30
提出日時 2016-02-11 19:07:00
言語 Java21
(openjdk 21)
結果
AC  
実行時間 121 ms / 5,000 ms
コード長 1,023 bytes
コンパイル時間 2,832 ms
コンパイル使用メモリ 75,168 KB
実行使用メモリ 57,616 KB
最終ジャッジ日時 2023-10-21 23:15:07
合計ジャッジ時間 5,477 ms
ジャッジサーバーID
(参考情報)
judge12 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
57,072 KB
testcase_01 AC 116 ms
57,396 KB
testcase_02 AC 112 ms
57,368 KB
testcase_03 AC 119 ms
57,396 KB
testcase_04 AC 120 ms
57,364 KB
testcase_05 AC 119 ms
57,340 KB
testcase_06 AC 120 ms
57,616 KB
testcase_07 AC 116 ms
57,400 KB
testcase_08 AC 102 ms
55,724 KB
testcase_09 AC 121 ms
57,532 KB
testcase_10 AC 116 ms
57,180 KB
testcase_11 AC 118 ms
57,396 KB
testcase_12 AC 107 ms
56,276 KB
testcase_13 AC 119 ms
57,456 KB
権限があれば一括ダウンロードができます

ソースコード

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