結果

問題 No.227 簡単ポーカー
ユーザー shinwisteriashinwisteria
提出日時 2018-02-15 23:38:44
言語 Java21
(openjdk 21)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 805 bytes
コンパイル時間 5,407 ms
コンパイル使用メモリ 73,160 KB
実行使用メモリ 57,408 KB
最終ジャッジ日時 2023-08-28 17:04:22
合計ジャッジ時間 8,358 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,824 KB
testcase_01 AC 126 ms
56,120 KB
testcase_02 AC 127 ms
55,492 KB
testcase_03 AC 129 ms
55,788 KB
testcase_04 AC 127 ms
55,904 KB
testcase_05 AC 129 ms
57,408 KB
testcase_06 AC 128 ms
55,424 KB
testcase_07 AC 127 ms
55,712 KB
testcase_08 AC 126 ms
55,656 KB
testcase_09 AC 128 ms
55,596 KB
testcase_10 AC 127 ms
53,776 KB
testcase_11 AC 127 ms
55,784 KB
testcase_12 AC 126 ms
55,884 KB
testcase_13 AC 127 ms
55,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package m.shin;
import java.util.HashSet;
import java.util.Scanner;
public class Con227 {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner s = new Scanner(System.in);
		HashSet<Integer> A = new HashSet<>();
		int daburi = 0,count = 0;
		for(int i = 0;i < 5;i++){
			int k = s.nextInt();
			if(A.contains(k)){
				if(daburi == k){
					count++;
				}else{
					daburi = k;
				}
			}else{
				A.add(k);
			}
		}
		s.close();
		if(A.size() == 2 && count < 2){
			System.out.println("FULL HOUSE");
		}else if(A.size() == 3){
			if(count == 1){
				System.out.println("THREE CARD");
			}else{
				System.out.println("TWO PAIR");
			}
		}else if(A.size() == 4){
			System.out.println("ONE PAIR");
		}else{
			System.out.println("NO HAND");
		}
	}

}
0