結果

問題 No.227 簡単ポーカー
ユーザー S1hoS1ho
提出日時 2017-02-27 14:12:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 130 ms / 5,000 ms
コード長 1,085 bytes
コンパイル時間 2,153 ms
コンパイル使用メモリ 71,952 KB
実行使用メモリ 56,360 KB
最終ジャッジ日時 2023-09-02 12:42:51
合計ジャッジ時間 4,834 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,420 KB
testcase_01 AC 127 ms
56,360 KB
testcase_02 AC 126 ms
56,160 KB
testcase_03 AC 128 ms
55,832 KB
testcase_04 AC 130 ms
55,516 KB
testcase_05 AC 130 ms
55,644 KB
testcase_06 AC 128 ms
55,948 KB
testcase_07 AC 127 ms
55,660 KB
testcase_08 AC 127 ms
55,708 KB
testcase_09 AC 127 ms
55,740 KB
testcase_10 AC 129 ms
55,684 KB
testcase_11 AC 128 ms
55,648 KB
testcase_12 AC 127 ms
55,680 KB
testcase_13 AC 128 ms
55,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner scanner = new Scanner(System.in);
        
        int[] card = new int[5];
        
        int[] num = new int[14];    //初期値は0
        
        for(int i=0;i<card.length;i++){
            card[i] = scanner.nextInt();
            num[card[i]] += 1;
        }
        
        int count2 = 0;
        int count3 = 0;
        
        //探索
        for(int i=1;i<num.length;i++){
            
            if(num[i] == 2){
                count2++;
            }else if(num[i] == 3){
                count3++;
            }
            
        }
        
        if(count3 == 1 && count2 == 1){
            System.out.println("FULL HOUSE");
        }else if(count3 == 1){
            System.out.println("THREE CARD");
        }else if(count2 == 2){
            System.out.println("TWO PAIR");
        }else if(count2 == 1){
            System.out.println("ONE PAIR");
        }else{
            System.out.println("NO HAND");
        }
        
    }
    
}
0