結果

問題 No.227 簡単ポーカー
ユーザー FVRChanFVRChan
提出日時 2017-10-03 00:07:14
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 945 bytes
コンパイル時間 2,549 ms
コンパイル使用メモリ 80,092 KB
実行使用メモリ 54,584 KB
最終ジャッジ日時 2024-04-27 18:17:46
合計ジャッジ時間 4,087 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 110 ms
54,232 KB
testcase_02 AC 103 ms
53,172 KB
testcase_03 AC 101 ms
52,920 KB
testcase_04 AC 112 ms
53,812 KB
testcase_05 AC 102 ms
52,764 KB
testcase_06 AC 111 ms
54,108 KB
testcase_07 AC 111 ms
54,028 KB
testcase_08 AC 112 ms
54,396 KB
testcase_09 AC 103 ms
53,216 KB
testcase_10 AC 112 ms
54,236 KB
testcase_11 AC 107 ms
53,244 KB
testcase_12 AC 105 ms
52,852 KB
testcase_13 AC 144 ms
54,112 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){
			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