結果

問題 No.227 簡単ポーカー
ユーザー fukuseifukusei
提出日時 2017-05-23 00:08:45
言語 Java21
(openjdk 21)
結果
AC  
実行時間 139 ms / 5,000 ms
コード長 812 bytes
コンパイル時間 2,282 ms
コンパイル使用メモリ 76,956 KB
実行使用メモリ 57,716 KB
最終ジャッジ日時 2023-10-19 14:18:32
合計ジャッジ時間 4,985 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
57,452 KB
testcase_01 AC 130 ms
57,588 KB
testcase_02 AC 122 ms
57,448 KB
testcase_03 AC 123 ms
57,240 KB
testcase_04 AC 131 ms
55,436 KB
testcase_05 AC 129 ms
57,456 KB
testcase_06 AC 139 ms
57,512 KB
testcase_07 AC 130 ms
57,716 KB
testcase_08 AC 135 ms
57,428 KB
testcase_09 AC 124 ms
57,480 KB
testcase_10 AC 126 ms
57,456 KB
testcase_11 AC 127 ms
57,476 KB
testcase_12 AC 124 ms
57,480 KB
testcase_13 AC 124 ms
57,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
class test{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int [] card = new int [5];
		int [] check = new int [13];
		int pair = 0;
		int trio = 0;
		
		for(int i=0; i<card.length; i++){
			card[i] = sc.nextInt();
		}
		
		for(int i=1; i<=13; i++){
			for(int j=0; j<5; j++){
				if(card[j] == i){
					check[i-1] ++;
				}
			}
		}
		
		for(int i=0; i<13; i++){
			if(check[i] == 2){
				pair++;
			}
			else if(check[i] == 3){
				trio++;
			}
		}

		if(trio == 1 && pair ==1){
			System.out.println("FULL HOUSE");
		}
		else if(trio == 1){
			System.out.println("THREE CARD");
		}
		else if(pair == 2){
			System.out.println("TWO PAIR");
		}
		else if(pair == 1){
			System.out.println("ONE PAIR");
		}
		else{
			System.out.println("NO HAND");
		}
	}
}
0