結果

問題 No.227 簡単ポーカー
ユーザー kou6839kou6839
提出日時 2015-06-20 01:23:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 1,420 bytes
コンパイル時間 2,158 ms
コンパイル使用メモリ 74,336 KB
実行使用メモリ 56,028 KB
最終ジャッジ日時 2023-09-21 10:28:52
合計ジャッジ時間 4,818 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,644 KB
testcase_01 AC 127 ms
55,856 KB
testcase_02 AC 128 ms
55,864 KB
testcase_03 AC 128 ms
55,652 KB
testcase_04 AC 126 ms
55,876 KB
testcase_05 AC 125 ms
55,920 KB
testcase_06 AC 126 ms
55,620 KB
testcase_07 AC 128 ms
56,028 KB
testcase_08 AC 126 ms
56,012 KB
testcase_09 AC 129 ms
55,672 KB
testcase_10 AC 129 ms
55,648 KB
testcase_11 AC 127 ms
55,824 KB
testcase_12 AC 127 ms
56,016 KB
testcase_13 AC 129 ms
55,828 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;



public class Main {
    public static void main(String[] args){
        // TODO 自動生成されたメソッド・スタブ
    	Scanner sc = new Scanner(System.in);
    	int[] hand = new int[5];
    	for(int i=0;i<5;i++) hand[i]=sc.nextInt();
    	Arrays.sort(hand);
    	if(hand[0]==hand[1] && hand[1]==hand[2]&&hand[2]==hand[3]){
    		System.out.println("NO HAND");
    		return;
    	}
    	if(hand[1]==hand[2] &&hand[2]==hand[3]&&hand[3]==hand[4]){
    		System.out.println("NO HAND");
    		return;
    	}
    	if(hand[0]==hand[1]&&hand[1]==hand[2] && hand[3]==hand[4] &&hand[0]!=hand[3]|| hand[0]==hand[1] && hand[2]==hand[3] &&hand[3]==hand[4]&&hand[0]!=hand[3]){
    		System.out.println("FULL HOUSE");
    		return;
    	}
    	if(hand[0]==hand[1] && hand[1]==hand[2] &&hand[0]!=hand[3] && hand[0]!=hand[4]|| hand[4]==hand[3] && hand[3]==hand[2]&&hand[4]!=hand[1]&&hand[4]!=hand[0]){
    		System.out.println("THREE CARD");
    		return;
    	}
    	if(hand[0]==hand[1] && hand[2]==hand[3] || hand[0]==hand[1]&&hand[3]==hand[4]||hand[1]==hand[2]&&hand[3]==hand[4]){
    		System.out.println("TWO PAIR");
    		return;
    	}
    	if(hand[0]==hand[1] || hand[1]==hand[2] || hand[2]==hand[3]||hand[3]==hand[4]){
    		System.out.println("ONE PAIR");
    		return;
    	}
    	System.out.println("NO HAND");
    }
}
0