結果

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

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int[] countArray = new int[14];
		for(int i = 0; i<5; i++) {
			int a = scan.nextInt();
			countArray[a] += 1;
		}
		int three = 0;
		int two = 0;
		
		for(int count : countArray) {
			if(count == 3) {
				three++;
			}
			else if(count == 2) {
				two++;
			}
		}
		if(three == 1 && two == 1) {
			System.out.println("FULL HOUSE");
		}
		else if(three == 1) {
			System.out.println("THREE CARD");
		}
		else if(two == 2) {
			System.out.println("TWO PAIR");
		}
		else if(two == 1) {
			System.out.println("ONE PAIR");
		} else {
			System.out.println("NO HAND");
		}		
	}
}
0