結果
| 問題 | No.227 簡単ポーカー | 
| コンテスト | |
| ユーザー |  uafr_cs | 
| 提出日時 | 2015-06-19 23:31:31 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 115 ms / 5,000 ms | 
| コード長 | 1,145 bytes | 
| コンパイル時間 | 1,829 ms | 
| コンパイル使用メモリ | 78,624 KB | 
| 実行使用メモリ | 55,800 KB | 
| 最終ジャッジ日時 | 2024-07-07 04:20:07 | 
| 合計ジャッジ時間 | 3,868 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 14 | 
ソースコード
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;
		}
	}
}
            
            
            
        