結果

問題 No.227 簡単ポーカー
ユーザー spaciaspacia
提出日時 2015-12-21 23:11:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 56 ms / 5,000 ms
コード長 989 bytes
コンパイル時間 4,291 ms
コンパイル使用メモリ 77,300 KB
実行使用メモリ 53,412 KB
最終ジャッジ日時 2023-10-18 22:09:44
合計ジャッジ時間 3,749 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
53,400 KB
testcase_01 AC 54 ms
53,400 KB
testcase_02 AC 56 ms
52,472 KB
testcase_03 AC 55 ms
53,412 KB
testcase_04 AC 56 ms
52,296 KB
testcase_05 AC 56 ms
53,400 KB
testcase_06 AC 55 ms
53,396 KB
testcase_07 AC 56 ms
53,392 KB
testcase_08 AC 55 ms
53,384 KB
testcase_09 AC 56 ms
53,392 KB
testcase_10 AC 55 ms
53,388 KB
testcase_11 AC 56 ms
53,392 KB
testcase_12 AC 56 ms
53,388 KB
testcase_13 AC 56 ms
53,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

class Main227 {
	
	public static void disp (Object obj) {
		System.out.println(obj);
	}
	
	public static String solve (int[] hand) {
		int cntTwo = 0, cntThree = 0;
		int[] seq = new int[14];
		
		for (int h : hand) seq[h]++;
		for (int s : seq) {
			if (s == 2) cntTwo++;
			if (s == 3) cntThree++;
		}
		
		if (cntThree == 1 && cntTwo == 1) {
			return "FULL HOUSE";
		} else if (cntThree == 1 && cntTwo == 0) {
			return "THREE CARD";
		} else if (cntThree == 0 && cntTwo == 2) {
			return "TWO PAIR";
		} else if (cntThree == 0 && cntTwo == 1) {
			return "ONE PAIR";
		} else {
			return "NO HAND";
		}
	}
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		String[] line = br.readLine().split(" ");
		int[] hand = new int[line.length];
		
		for (int i = 0; i < line.length; i++)
			hand[i] = Integer.parseInt(line[i]);
		
		disp(solve(hand));
	}
}
0