結果

問題 No.227 簡単ポーカー
ユーザー koukonkokoukonko
提出日時 2015-12-18 15:48:38
言語 Java21
(openjdk 21)
結果
AC  
実行時間 46 ms / 5,000 ms
コード長 1,153 bytes
コンパイル時間 5,408 ms
コンパイル使用メモリ 73,164 KB
実行使用メモリ 49,308 KB
最終ジャッジ日時 2023-10-14 13:58:39
合計ジャッジ時間 3,779 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
49,132 KB
testcase_01 AC 45 ms
49,308 KB
testcase_02 AC 44 ms
49,252 KB
testcase_03 AC 45 ms
49,088 KB
testcase_04 AC 45 ms
48,984 KB
testcase_05 AC 45 ms
49,092 KB
testcase_06 AC 45 ms
48,992 KB
testcase_07 AC 45 ms
47,292 KB
testcase_08 AC 46 ms
49,268 KB
testcase_09 AC 45 ms
49,260 KB
testcase_10 AC 46 ms
49,104 KB
testcase_11 AC 45 ms
46,936 KB
testcase_12 AC 45 ms
49,060 KB
testcase_13 AC 44 ms
49,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		BufferedReader read = new BufferedReader(new InputStreamReader(System.in));

		try {
			String[] box = read.readLine().split(" ");
			int[] num = new int[5];
			for (int i = 0; i < 5; ++i) {
				num[i] = Integer.parseInt(box[i]);
			}

			int[] count = new int[5];
			for (int i = 0; i < 5; ++i) {
				for (int j = 0; j < 5; ++j) {
					if (i != j) {
						if (num[i] == num[j]) {
							count[i]++;
						}
					}
				}
			}

			boolean th = false, tw = false;
			int twCount = 0;
			for (int i = 0; i < 5; ++i) {
				if (count[i] == 2) {
					th = true;
				} else if (count[i] == 1) {
					tw = true;
					twCount++;
				}
			}

			if (th && tw) {
				System.out.println("FULL HOUSE");
			} else if (th) {
				System.out.println("THREE CARD");
			} else if (tw && twCount == 4) {
				System.out.println("TWO PAIR");
			} else if (tw && twCount == 2) {
				System.out.println("ONE PAIR");
			} else {
				System.out.println("NO HAND");
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
0