結果

問題 No.227 簡単ポーカー
ユーザー moriyuki
提出日時 2023-04-14 18:33:53
言語 Java
(openjdk 23)
結果
AC  
実行時間 136 ms / 5,000 ms
コード長 1,042 bytes
コンパイル時間 5,809 ms
コンパイル使用メモリ 77,856 KB
実行使用メモリ 54,180 KB
最終ジャッジ日時 2024-10-10 09:38:36
合計ジャッジ時間 8,549 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;
import java.util.Scanner;

public class poker {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int[] n = new int[14];
        int[] a = new int[5];
        int three = 0;
        int two = 0;
        
        for (int i = 0; i<5; i++) {
        	a[i] = Integer.parseInt(sc.next());
        }
        
        for (int i = 0; i < 5; i++) {
        	n[a[i]]++;
        }
        
        for (int i = 0; i < n.length; i++) {
        	switch (n[i]) {
        	case 2 :
        		two++;
        		break;
        	case 3 :
        		three++;
        		break;
        	}
        }
        
        if (two == 1 && three == 1) {
        	System.out.println("FULL HOUSE");
        } else if (three == 1) {
        	System.out.println("THREE CARD");
        } else if (two == 2) {
        	System.out.println("TWO PAIR");
        } else if (two == 1) {
        	System.out.println("ONE PAIR");
        } else {
        	System.out.println("NO HAND");
        }
        
	}
}
0