結果

問題 No.227 簡単ポーカー
ユーザー dazydazy
提出日時 2017-02-27 16:48:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 5,000 ms
コード長 1,266 bytes
コンパイル時間 3,635 ms
コンパイル使用メモリ 75,092 KB
実行使用メモリ 56,204 KB
最終ジャッジ日時 2023-09-02 12:48:18
合計ジャッジ時間 6,340 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
56,204 KB
testcase_01 AC 128 ms
55,952 KB
testcase_02 AC 127 ms
56,148 KB
testcase_03 AC 127 ms
55,536 KB
testcase_04 AC 127 ms
56,176 KB
testcase_05 AC 127 ms
56,156 KB
testcase_06 AC 129 ms
55,816 KB
testcase_07 AC 132 ms
55,864 KB
testcase_08 AC 126 ms
55,984 KB
testcase_09 AC 127 ms
56,148 KB
testcase_10 AC 126 ms
56,204 KB
testcase_11 AC 126 ms
55,892 KB
testcase_12 AC 130 ms
53,772 KB
testcase_13 AC 128 ms
55,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Run {
    public static void main (String arg[]) {
        Scanner scan = new Scanner(System.in);
        String ans = "NO HAND";
        int tmp;
        boolean one = false, two = false, three = false, full = false, bad = false;
        ArrayList<Integer> A = new ArrayList<>();

        for (int i = 0; i < 5; i++) {
            tmp = scan.nextInt();
            if (!A.contains(tmp)) A.add(tmp);
            else {
                tmp *= 100;
                if (!A.contains(tmp)) {
                    if (!one) {
                        A.add(tmp);
                        one = true;
                    } else {
                        A.add(tmp);
                        two = true;
                        if (three) full = true;
                    }
                } else {
                    if (!two && three) bad = true;
                    else if (one && !two) three = true;
                    else if (one && two) full = true;
                }
            }
        }

        if (bad) ;
        else if (full) ans = "FULL HOUSE";
        else if (three) ans = "THREE CARD";
        else if (two) ans = "TWO PAIR";
        else if (one) ans = "ONE PAIR";
        else ;
        System.out.println(ans);
    }
}
0