結果

問題 No.227 簡単ポーカー
ユーザー ginmakura
提出日時 2017-10-19 20:57:17
言語 Java
(openjdk 23)
結果
AC  
実行時間 132 ms / 5,000 ms
コード長 1,089 bytes
コンパイル時間 2,183 ms
コンパイル使用メモリ 77,992 KB
実行使用メモリ 41,472 KB
最終ジャッジ日時 2024-11-21 07:39:24
合計ジャッジ時間 4,914 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.lang.Math;

class N227 {
	public static void main(String[] args) throws Exception{
		try (Scanner sc1 = new Scanner(System.in)) {
		
			int[] impnum = new int[5];
			int[] huriwake = new int[13];
			
			int three = 0;
			int two = 0;
			
			// 入力
			impnum[0] = Integer.parseInt(sc1.next());
			impnum[1] = Integer.parseInt(sc1.next());
			impnum[2] = Integer.parseInt(sc1.next());
			impnum[3] = Integer.parseInt(sc1.next());
			impnum[4] = Integer.parseInt(sc1.next());
			
			for(int i = 0;i < 5;i++){
				huriwake[impnum[i] - 1]++;
			}
			
			for(int j = 0;j < 13;j++){
				switch(huriwake[j]){
					case 3:
						three++;
						break;
					case 2:
						two++;
						break;
				}
			}
			
			String result = "NO HAND";
			if(three == 1 && two == 1){
				result = "FULL HOUSE" ;
			}else if(three == 1){
				result = "THREE CARD" ;
			}else if(two == 2){
				result = "TWO PAIR" ;
			}else if(two == 1){
				result = "ONE PAIR" ;
			}
			
			System.out.println(result);
		}
	}
}
0