結果

問題 No.227 簡単ポーカー
ユーザー moriyukimoriyuki
提出日時 2023-04-14 18:33:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 1,042 bytes
コンパイル時間 4,674 ms
コンパイル使用メモリ 77,432 KB
実行使用メモリ 54,344 KB
最終ジャッジ日時 2024-04-18 16:22:51
合計ジャッジ時間 5,956 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
53,956 KB
testcase_01 AC 124 ms
54,004 KB
testcase_02 AC 123 ms
54,344 KB
testcase_03 AC 125 ms
54,144 KB
testcase_04 AC 124 ms
54,028 KB
testcase_05 AC 128 ms
54,148 KB
testcase_06 AC 121 ms
53,940 KB
testcase_07 AC 129 ms
54,228 KB
testcase_08 AC 108 ms
52,744 KB
testcase_09 AC 126 ms
54,080 KB
testcase_10 AC 124 ms
53,884 KB
testcase_11 AC 123 ms
54,204 KB
testcase_12 AC 124 ms
54,172 KB
testcase_13 AC 125 ms
54,020 KB
権限があれば一括ダウンロードができます

ソースコード

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