結果

問題 No.227 簡単ポーカー
ユーザー sasakki
提出日時 2016-03-22 10:29:46
言語 Java
(openjdk 23)
結果
AC  
実行時間 115 ms / 5,000 ms
コード長 744 bytes
コンパイル時間 2,129 ms
コンパイル使用メモリ 74,636 KB
実行使用メモリ 41,484 KB
最終ジャッジ日時 2024-10-01 12:48:43
合計ジャッジ時間 3,862 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.Arrays;

class main{
    public static void main(String args[]){
	Scanner scan = new Scanner(System.in);

	int card[] = new int[13];

	Arrays.fill(card, 0);

	for(int i = 0; i < 5; i++){
	    int num = scan.nextInt();

	    card[num - 1]++;
	}
	
	int thf = 0;
	int twf = 0;

	for(int i = 0; i < 13; i++){
	    if(card[i] == 3){
		thf++;
	    }
	    else if(card[i] == 2){
		twf++;
	    }
	}

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