結果

問題 No.227 簡単ポーカー
ユーザー FVRChan
提出日時 2017-10-03 00:07:14
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 945 bytes
コンパイル時間 2,525 ms
コンパイル使用メモリ 78,816 KB
実行使用メモリ 41,664 KB
最終ジャッジ日時 2024-11-15 22:43:10
合計ジャッジ時間 5,049 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13 WA * 1
権限があれば一括ダウンロードができます

ソースコード

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){
			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