結果

問題 No.227 簡単ポーカー
ユーザー scachescache
提出日時 2015-09-19 15:51:34
言語 Java19
(openjdk 21)
結果
AC  
実行時間 132 ms / 5,000 ms
コード長 819 bytes
コンパイル時間 3,615 ms
コンパイル使用メモリ 75,824 KB
実行使用メモリ 56,076 KB
最終ジャッジ日時 2023-09-26 13:38:14
合計ジャッジ時間 6,528 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,552 KB
testcase_01 AC 129 ms
55,964 KB
testcase_02 AC 130 ms
55,912 KB
testcase_03 AC 131 ms
54,136 KB
testcase_04 AC 132 ms
56,076 KB
testcase_05 AC 130 ms
55,864 KB
testcase_06 AC 129 ms
55,864 KB
testcase_07 AC 127 ms
55,972 KB
testcase_08 AC 125 ms
56,076 KB
testcase_09 AC 128 ms
55,472 KB
testcase_10 AC 129 ms
55,788 KB
testcase_11 AC 130 ms
55,976 KB
testcase_12 AC 132 ms
55,792 KB
testcase_13 AC 129 ms
55,732 KB
権限があれば一括ダウンロードができます

ソースコード

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