結果

問題 No.227 簡単ポーカー
ユーザー youthfuldays072youthfuldays072
提出日時 2018-05-19 13:59:48
言語 Java21
(openjdk 21)
結果
AC  
実行時間 135 ms / 5,000 ms
コード長 973 bytes
コンパイル時間 2,210 ms
コンパイル使用メモリ 76,908 KB
実行使用メモリ 55,976 KB
最終ジャッジ日時 2023-09-10 23:42:17
合計ジャッジ時間 5,001 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
55,940 KB
testcase_01 AC 130 ms
55,976 KB
testcase_02 AC 131 ms
53,524 KB
testcase_03 AC 135 ms
55,892 KB
testcase_04 AC 132 ms
55,604 KB
testcase_05 AC 135 ms
55,752 KB
testcase_06 AC 135 ms
55,784 KB
testcase_07 AC 129 ms
55,920 KB
testcase_08 AC 134 ms
55,784 KB
testcase_09 AC 131 ms
55,616 KB
testcase_10 AC 129 ms
55,788 KB
testcase_11 AC 130 ms
55,928 KB
testcase_12 AC 132 ms
55,948 KB
testcase_13 AC 131 ms
55,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {


    public static void main(String[] args) {

    	Scanner sc=new Scanner(System.in);

    	Map<Integer,Integer> map=new TreeMap<Integer,Integer>();

    	for(int i=0;i<5;i++) {

    		int buf=sc.nextInt();

    		if(map.containsKey(buf)) {

    			map.put(buf,map.get(buf)+1);

    		}else {

    			map.put(buf,1);
    		}

    	}

    	int CountTree=0;
    	int CountTwo=0;

    	for(Integer i:map.values()) {

    		if(i.intValue()==3) {
    			CountTree++;
    		}else if(i.intValue()==2){
    			CountTwo++;
    		}
    	}

    	String result=null;

    	if(CountTree==1 && CountTwo==1) {
    		result="FULL HOUSE";
    	}else if(CountTree==1) {
    		result="THREE CARD";
    	}else if(CountTwo==2) {
    		result="TWO PAIR";
    	}else if(CountTwo==1) {
    		result="ONE PAIR";
    	}else {
    		result="NO HAND";
    	}

    	System.out.println(result);

    }

}

0