結果

問題 No.227 簡単ポーカー
ユーザー syu
提出日時 2020-08-26 23:05:44
言語 Java
(openjdk 23)
結果
AC  
実行時間 135 ms / 5,000 ms
コード長 1,044 bytes
コンパイル時間 2,247 ms
コンパイル使用メモリ 78,544 KB
実行使用メモリ 41,424 KB
最終ジャッジ日時 2024-11-07 14:18:53
合計ジャッジ時間 4,807 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

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