結果

問題 No.227 簡単ポーカー
ユーザー fal_rndfal_rnd
提出日時 2017-08-08 17:57:18
言語 Java21
(openjdk 21)
結果
AC  
実行時間 123 ms / 5,000 ms
コード長 1,254 bytes
コンパイル時間 2,384 ms
コンパイル使用メモリ 91,420 KB
実行使用メモリ 54,380 KB
最終ジャッジ日時 2024-04-20 05:12:10
合計ジャッジ時間 5,021 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
54,380 KB
testcase_01 AC 121 ms
54,296 KB
testcase_02 AC 122 ms
54,132 KB
testcase_03 AC 108 ms
53,276 KB
testcase_04 AC 109 ms
52,940 KB
testcase_05 AC 118 ms
54,264 KB
testcase_06 AC 118 ms
54,312 KB
testcase_07 AC 108 ms
53,376 KB
testcase_08 AC 123 ms
54,184 KB
testcase_09 AC 119 ms
54,280 KB
testcase_10 AC 117 ms
54,336 KB
testcase_11 AC 118 ms
54,164 KB
testcase_12 AC 117 ms
53,236 KB
testcase_13 AC 114 ms
53,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;
import java.util.TreeMap;
import java.util.stream.IntStream;

public class Main{
	static Scanner s=new Scanner(System.in);
	static int getInt(){return Integer.parseInt(s.next());}
	static IntStream REPS(int v){return IntStream.range(0,v);}
	static IntStream REPS(int l,int r){return IntStream.rangeClosed(l,r);}
	static IntStream INS(int n) {return REPS(n).map(i->getInt());}
	static class Pair<T,U>{
		T l;U r;
		Pair(T L,U R){l=L;r=R;}
		T getL(){return l;}
		U getR(){return r;}
	}

	public static void main(String[]$){
		TreeMap<Integer,Integer> hm=new TreeMap<>();
		hm.merge(getInt(),1,Integer::sum);
		hm.merge(getInt(),1,Integer::sum);
		hm.merge(getInt(),1,Integer::sum);
		hm.merge(getInt(),1,Integer::sum);
		hm.merge(getInt(),1,Integer::sum);

		int[] v=hm.values().stream().mapToInt(i->i).sorted().toArray();

		if(Arrays.equals(v,new int[]{2,3})) {
			System.out.println("FULL HOUSE");
		}else if(Arrays.equals(v,new int[]{1,1,3})){
			System.out.println("THREE CARD");
		}else if(Arrays.equals(v,new int[]{1,2,2})){
			System.out.println("TWO PAIR");
		}else if(Arrays.equals(v,new int[]{1,1,1,2})){
			System.out.println("ONE PAIR");
		}else {
			System.out.println("NO HAND");
		}
	}
}
0