結果

問題 No.227 簡単ポーカー
ユーザー syusyu
提出日時 2020-08-26 23:05:44
言語 Java21
(openjdk 21)
結果
AC  
実行時間 138 ms / 5,000 ms
コード長 1,044 bytes
コンパイル時間 2,284 ms
コンパイル使用メモリ 78,576 KB
実行使用メモリ 41,456 KB
最終ジャッジ日時 2024-04-25 04:21:39
合計ジャッジ時間 4,990 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
40,984 KB
testcase_01 AC 136 ms
41,004 KB
testcase_02 AC 124 ms
39,816 KB
testcase_03 AC 138 ms
41,324 KB
testcase_04 AC 135 ms
41,292 KB
testcase_05 AC 135 ms
41,216 KB
testcase_06 AC 133 ms
41,356 KB
testcase_07 AC 133 ms
41,164 KB
testcase_08 AC 137 ms
41,456 KB
testcase_09 AC 135 ms
41,292 KB
testcase_10 AC 133 ms
41,136 KB
testcase_11 AC 135 ms
41,216 KB
testcase_12 AC 133 ms
41,096 KB
testcase_13 AC 135 ms
41,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        Map<Integer,Integer> map=new HashMap<>();
        for(int i=1;i<=13;i++){
            map.put(i,0);
        }
        
        for(int i=0;i<5;i++){
            int num=sc.nextInt();
            int value=map.get(num)+1;
            map.put(num,value);
        }
        int count_3=0;
        int count_2=0;
        for(int key:map.keySet()){
            int value=map.get(key);
            if(value==3){
                count_3++;
            }else if(value==2){
                count_2++;
            }
        }
        
        if(count_3==1 && count_2==1){
            System.out.println("FULL HOUSE");
        }else if(count_3==1){
            System.out.println("THREE CARD");
        }else if(count_2==2){
            System.out.println("TWO PAIR");
        }else if(count_2==1){
            System.out.println("ONE PAIR");
        }else{
            System.out.println("NO HAND");
        }
    }
}
0