結果

問題 No.227 簡単ポーカー
ユーザー jimanojimano
提出日時 2018-01-13 16:37:29
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 732 bytes
コンパイル時間 3,357 ms
コンパイル使用メモリ 75,480 KB
実行使用メモリ 56,368 KB
最終ジャッジ日時 2023-08-25 15:47:32
合計ジャッジ時間 4,749 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 98 ms
55,968 KB
testcase_02 AC 99 ms
56,304 KB
testcase_03 AC 98 ms
55,620 KB
testcase_04 AC 91 ms
55,928 KB
testcase_05 AC 93 ms
56,220 KB
testcase_06 AC 90 ms
55,964 KB
testcase_07 AC 90 ms
55,764 KB
testcase_08 AC 91 ms
55,940 KB
testcase_09 AC 88 ms
56,016 KB
testcase_10 AC 97 ms
55,708 KB
testcase_11 AC 101 ms
55,372 KB
testcase_12 AC 101 ms
55,564 KB
testcase_13 AC 90 ms
55,524 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<String, Integer> cards = new HashMap<>();

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

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

	static String judge(Map<String, 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