結果

問題 No.227 簡単ポーカー
ユーザー mos_13184925
提出日時 2018-06-18 12:04:36
言語 Java
(openjdk 23)
結果
AC  
実行時間 133 ms / 5,000 ms
コード長 813 bytes
コンパイル時間 2,378 ms
コンパイル使用メモリ 75,016 KB
実行使用メモリ 54,404 KB
最終ジャッジ日時 2024-06-30 16:51:58
合計ジャッジ時間 4,588 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[14];
        for(int i = 0; i < 5; i++) {
            a[sc.nextInt()]++;
        }
        int two = 0;
        int three = 0;
        for(int i = 1; i < 14; i++) {
            if(a[i] == 2) {
                two++;
            } else if (a[i] == 3) {
                three++;
            }
        }
        String result = "NO HAND";
        if(two == 1 && three == 1) {
            result = "FULL HOUSE";
        } else if(three == 1) {
            result = "THREE CARD";
        } else if(two == 2) {
            result = "TWO PAIR";
        } else if(two == 1) {
            result  = "ONE PAIR";
        }
        System.out.println(result);
    }
}
0