結果

問題 No.227 簡単ポーカー
ユーザー jimanojimano
提出日時 2018-01-13 16:31:25
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 734 bytes
コンパイル時間 5,530 ms
コンパイル使用メモリ 79,456 KB
実行使用メモリ 41,300 KB
最終ジャッジ日時 2024-06-06 10:05:49
合計ジャッジ時間 7,474 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 114 ms
39,932 KB
testcase_02 AC 128 ms
40,888 KB
testcase_03 AC 124 ms
40,748 KB
testcase_04 AC 132 ms
41,064 KB
testcase_05 AC 119 ms
40,956 KB
testcase_06 AC 115 ms
40,936 KB
testcase_07 AC 110 ms
41,300 KB
testcase_08 AC 120 ms
41,004 KB
testcase_09 AC 111 ms
41,040 KB
testcase_10 AC 121 ms
39,876 KB
testcase_11 AC 122 ms
39,880 KB
testcase_12 AC 124 ms
40,884 KB
testcase_13 AC 125 ms
40,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package me.yukicoder.lv1;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class No0227 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Map<Integer, Integer> cards = new HashMap<>();

		for (int i = 0; i < 5; i++) {
			int key = sc.nextInt();
			cards.computeIfPresent(key, (k, v) -> v + 1);
			cards.putIfAbsent(key, 1);
		}

		System.out.println(judge(cards));
	}

	static String judge(Map<Integer, Integer> cards) {
		if (cards.size() == 2) {
			return "FULL HOUSE";
		}
		if (cards.containsValue(3)) {
			return "THREE CARD";
		}
		if (cards.size() == 3) {
			return "TWO PAIR";
		}
		if (cards.size() == 4) {
			return "ONE PAIR";
		}
		return "NO HAND";
	}
}
0