結果

問題 No.227 簡単ポーカー
ユーザー FVRChanFVRChan
提出日時 2017-10-03 00:08:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 5,000 ms
コード長 1,085 bytes
コンパイル時間 2,282 ms
コンパイル使用メモリ 79,640 KB
実行使用メモリ 54,032 KB
最終ジャッジ日時 2024-04-27 18:17:51
合計ジャッジ時間 4,128 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
53,164 KB
testcase_01 AC 106 ms
52,956 KB
testcase_02 AC 105 ms
52,692 KB
testcase_03 AC 111 ms
52,648 KB
testcase_04 AC 112 ms
53,348 KB
testcase_05 AC 109 ms
52,612 KB
testcase_06 AC 116 ms
53,612 KB
testcase_07 AC 107 ms
52,908 KB
testcase_08 AC 107 ms
52,880 KB
testcase_09 AC 110 ms
52,648 KB
testcase_10 AC 116 ms
54,032 KB
testcase_11 AC 115 ms
53,124 KB
testcase_12 AC 125 ms
53,704 KB
testcase_13 AC 112 ms
53,892 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Scanner;
public class Main{
	private static Scanner sc=new Scanner(System.in);
	public static void main(String args[])throws Exception{
		HashMap<Integer,Integer>map=new HashMap<Integer,Integer>();
		LinkedList<Integer>queue=new LinkedList<Integer>();
		for(int i=0;i<5;i++){
			int temp=sc.nextInt();
			if(map.containsKey(temp)==false){
				map.put(temp,1);
				queue.offer(temp);
			}else{
				map.put(temp,map.get(temp)+1);
			}
		}Collections.sort(queue);
		if(queue.size()==2){
			boolean flag=false;
			for(Integer element:queue){
				if(map.get(element)==4)flag=true;
			}if(flag)System.out.println("NO HAND");
			else System.out.println("FULL HOUSE");
		}else if(queue.size()==3){
			boolean flag=false;
			for(Integer element:queue){
				if(map.get(element)==3)flag=true;
			}if(flag)System.out.println("THREE CARD");
			else System.out.println("TWO PAIR");
		}else if(queue.size()==4){
			System.out.println("ONE PAIR");
		}else{
			System.out.println("NO HAND");
		}
	}
}
0