結果

問題 No.227 簡単ポーカー
ユーザー ginmakuraginmakura
提出日時 2017-10-19 20:57:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 123 ms / 5,000 ms
コード長 1,089 bytes
コンパイル時間 2,205 ms
コンパイル使用メモリ 77,644 KB
実行使用メモリ 54,292 KB
最終ジャッジ日時 2024-05-01 05:59:47
合計ジャッジ時間 4,530 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
53,948 KB
testcase_01 AC 120 ms
54,072 KB
testcase_02 AC 120 ms
54,124 KB
testcase_03 AC 120 ms
54,092 KB
testcase_04 AC 119 ms
53,832 KB
testcase_05 AC 122 ms
54,188 KB
testcase_06 AC 123 ms
53,848 KB
testcase_07 AC 122 ms
54,292 KB
testcase_08 AC 109 ms
52,952 KB
testcase_09 AC 123 ms
54,040 KB
testcase_10 AC 108 ms
52,812 KB
testcase_11 AC 122 ms
54,228 KB
testcase_12 AC 123 ms
54,004 KB
testcase_13 AC 122 ms
54,048 KB
権限があれば一括ダウンロードができます

ソースコード

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