結果

問題 No.227 簡単ポーカー
ユーザー TwinkleStar74TwinkleStar74
提出日時 2017-10-24 12:00:15
言語 Java21
(openjdk 21)
結果
AC  
実行時間 40 ms / 5,000 ms
コード長 1,150 bytes
コンパイル時間 2,869 ms
コンパイル使用メモリ 74,120 KB
実行使用メモリ 49,820 KB
最終ジャッジ日時 2023-08-13 23:29:40
合計ジャッジ時間 4,144 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
49,768 KB
testcase_01 AC 40 ms
49,756 KB
testcase_02 AC 38 ms
49,244 KB
testcase_03 AC 38 ms
49,268 KB
testcase_04 AC 39 ms
49,484 KB
testcase_05 AC 39 ms
49,544 KB
testcase_06 AC 37 ms
49,820 KB
testcase_07 AC 38 ms
49,372 KB
testcase_08 AC 37 ms
49,480 KB
testcase_09 AC 38 ms
49,320 KB
testcase_10 AC 38 ms
49,268 KB
testcase_11 AC 37 ms
49,380 KB
testcase_12 AC 38 ms
49,544 KB
testcase_13 AC 39 ms
49,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.Arrays;

public class No227{
    public static void main(String[] args) throws IOException{
        String[] str = new BufferedReader(new InputStreamReader(System.in)).readLine().split(" ");
        int[] hand = new int[14];
        int[] strToInt = new int[str.length];
        for(int i=0; i < str.length; i++)  strToInt[i] = Integer.parseInt(str[i]);
        for(int i=0; i < str.length; i++)  hand[strToInt[i]]++;
        Arrays.sort(hand);
        reverse(hand);
        judge(hand);
    }
    
    public static void reverse(int[] a){
        int temp = 0;
        for(int i=0; i < a.length / 2; i++){
            temp = a[i];
            a[i] = a[a.length - 1 - i];
            a[a.length - 1 - i] = temp;
        }
    }
    
    public static void judge(int[] a){
        if(a[0] == 3){
            if(a[1] == 2) System.out.println("FULL HOUSE"); 
            else System.out.println("THREE CARD");
        }
        else if(a[0] == 2){
            if(a[1] == 2) System.out. println("TWO PAIR");
            else System.out.println("ONE PAIR");
        }
        else System.out.println("NO HAND");
    }
}
0