結果

問題 No.227 簡単ポーカー
ユーザー scache
提出日時 2015-09-19 15:51:34
言語 Java
(openjdk 23)
結果
AC  
実行時間 130 ms / 5,000 ms
コード長 819 bytes
コンパイル時間 3,618 ms
コンパイル使用メモリ 78,044 KB
実行使用メモリ 41,840 KB
最終ジャッジ日時 2024-07-19 07:57:19
合計ジャッジ時間 5,668 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class Main227 {
	public static void main(String[] args) {
		Main227 p = new Main227();
	}

	public Main227() {
		Scanner sc = new Scanner(System.in);
		int n = 5;
		int[] a = new int[n];
		for(int i=0;i<n;i++){
			a[i] = sc.nextInt();
		}
		solve(a);
	}

	public void solve(int[] a) {
		int[] count = new int[13];
		for(int i=0;i<a.length;i++){
			count[a[i]-1]++;
		}
		
		Arrays.sort(count);
		
		int size = count.length;
		if(count[size-1]==3){
			if(count[size-2]==2){
				System.out.println("FULL HOUSE");
			}else{
				System.out.println("THREE CARD");
			}
		}else if(count[size-1]==2){
			if(count[size-2]==2){
				System.out.println("TWO PAIR");
			}else{
				System.out.println("ONE PAIR");
			}
		}else{
			System.out.println("NO HAND");
		}
	}

}
0