結果
問題 | No.227 簡単ポーカー |
ユーザー | 水野嶺 |
提出日時 | 2020-05-28 12:03:30 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 138 ms / 5,000 ms |
コード長 | 784 bytes |
コンパイル時間 | 2,049 ms |
コンパイル使用メモリ | 75,772 KB |
実行使用メモリ | 54,636 KB |
最終ジャッジ日時 | 2024-04-21 05:35:04 |
合計ジャッジ時間 | 4,639 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 130 ms
53,612 KB |
testcase_01 | AC | 126 ms
53,540 KB |
testcase_02 | AC | 129 ms
54,220 KB |
testcase_03 | AC | 131 ms
54,128 KB |
testcase_04 | AC | 130 ms
53,612 KB |
testcase_05 | AC | 130 ms
53,884 KB |
testcase_06 | AC | 128 ms
54,076 KB |
testcase_07 | AC | 131 ms
53,796 KB |
testcase_08 | AC | 136 ms
53,864 KB |
testcase_09 | AC | 138 ms
53,940 KB |
testcase_10 | AC | 136 ms
54,020 KB |
testcase_11 | AC | 132 ms
53,808 KB |
testcase_12 | AC | 133 ms
54,000 KB |
testcase_13 | AC | 131 ms
54,636 KB |
ソースコード
import java.util.*; import java.lang.*; import java.io.*; class Main { public static void main (String[] args) { // 入力値の読み込み Scanner sc = new Scanner(System.in); ArrayList<String> a=new ArrayList<>(); for(int i=0;i<5;i++){ a.add(sc.next()); } int three=0; int two=0; String ans = "NO HAND"; // カウント TreeSet<String> b=new TreeSet<>(a); for(String s:b){ int coun=0; for(String c:a){ if(s.equals(c))coun++; } if(coun == 3){ three +=1; }else if(coun == 2){ two +=1; } } // 判定 if(three==1){ if(two==1){ ans="FULL HOUSE"; }else{ ans="THREE CARD"; } }else if(two==2){ ans="TWO PAIR"; }else if(two==1){ ans="ONE PAIR"; } System.out.println(ans); } }