結果

問題 No.227 簡単ポーカー
コンテスト
ユーザー spacia
提出日時 2015-12-21 23:11:47
言語 Java
(openjdk 27 + ACL)
コンパイル:
javac -J-Duser.language=en -encoding UTF8 -cp /opt/aclib/ac_library.jar _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true -cp .:/opt/aclib/ac_library.jar _class_
結果
AC  
実行時間 31 ms / 5,000 ms
+ 270µs
コード長 989 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,425 ms
コンパイル使用メモリ 85,776 KB
実行使用メモリ 43,560 KB
最終ジャッジ日時 2026-10-11 03:03:15
合計ジャッジ時間 3,094 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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