結果

問題 No.227 簡単ポーカー
ユーザー uafr_csuafr_cs
提出日時 2015-06-19 23:31:31
言語 Java21
(openjdk 21)
結果
AC  
実行時間 121 ms / 5,000 ms
コード長 1,145 bytes
コンパイル時間 1,923 ms
コンパイル使用メモリ 74,484 KB
実行使用メモリ 57,844 KB
最終ジャッジ日時 2023-09-21 10:15:36
合計ジャッジ時間 4,365 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,832 KB
testcase_01 AC 119 ms
55,980 KB
testcase_02 AC 118 ms
56,184 KB
testcase_03 AC 116 ms
56,048 KB
testcase_04 AC 118 ms
55,776 KB
testcase_05 AC 118 ms
57,844 KB
testcase_06 AC 116 ms
55,924 KB
testcase_07 AC 116 ms
55,540 KB
testcase_08 AC 117 ms
55,684 KB
testcase_09 AC 115 ms
56,316 KB
testcase_10 AC 117 ms
56,032 KB
testcase_11 AC 118 ms
55,872 KB
testcase_12 AC 119 ms
55,928 KB
testcase_13 AC 120 ms
55,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main {
	
	public static final int SIZE = 5;
	public static final int RANGE = 13;
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		final int[] arr = new int[SIZE];
		for(int i = 0; i < SIZE; i++){
			arr[i] = sc.nextInt() - 1;
		}
		
		int[] counts = new int[RANGE];
		for(int i = 0; i < SIZE; i++){
			counts[arr[i]]++;
		}
		int fst_max = 0, snd_max = 0;
		for(int i = 0; i < RANGE; i++){
			if(fst_max < counts[i]){
				snd_max = fst_max;
				fst_max = counts[i];
			}else if(snd_max < counts[i]){
				snd_max = counts[i];
			}
		}
		
		switch(fst_max){
		case 3:
			if(snd_max >= 2){
				System.out.println("FULL HOUSE");
			}else{
				System.out.println("THREE CARD");
			}
			break;
		case 2:
			if(snd_max >= 2){
				System.out.println("TWO PAIR");
			}else{
				System.out.println("ONE PAIR");
			}
			break;
		default:
			System.out.println("NO HAND");
			break;
		}
	}
}
0