結果
問題 | No.227 簡単ポーカー |
ユーザー | rf141 |
提出日時 | 2015-06-28 22:56:43 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,634 bytes |
コンパイル時間 | 3,775 ms |
コンパイル使用メモリ | 74,640 KB |
実行使用メモリ | 57,752 KB |
最終ジャッジ日時 | 2023-09-22 04:09:33 |
合計ジャッジ時間 | 6,614 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 138 ms
53,976 KB |
testcase_05 | AC | 134 ms
55,736 KB |
testcase_06 | AC | 137 ms
55,728 KB |
testcase_07 | WA | - |
testcase_08 | AC | 141 ms
55,668 KB |
testcase_09 | AC | 142 ms
55,724 KB |
testcase_10 | AC | 136 ms
55,512 KB |
testcase_11 | AC | 140 ms
55,680 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
ソースコード
import java.util.*; public class EasyPorker { public static void main(String[] args){ Scanner scan = new Scanner(System.in); int[] card = new int[5]; for(int i=0;i<5;i++){ card[i]=scan.nextInt(); } Map<Integer,Integer> cardNum = new HashMap<Integer,Integer>(); for(int i=0; i < 5; i++){ if(!cardNum.containsKey(card[i])){ cardNum.put(card[i], 1); }else{ int getNum = cardNum.get(card[i]); cardNum.put(card[i], getNum++); } } System.out.println(checkHands(cardNum)); } public static String checkHands(Map<Integer, Integer> cardNum){ boolean check_two=false,check_three=false,check_full=false; boolean check_two2=false,check_three2=false,check_full2=false; switch(cardNum.size()){ case 5: return "NO HAND"; case 4: return "ONE PAIR"; case 3: for(int i = 1; i <= 13; i++){ if(cardNum.containsKey(i)){ int get = cardNum.get(i); if(get==2){ check_two=true; check_full=true; }else if(get==3){ check_three2=true; check_full2=true; } } } if(check_two&&!check_two2)return "TWO PAIR"; if(!check_three&&check_three2)return "THREE CARD"; if(check_full&&check_full2)return "FULL HOUSE"; break; case 2: for(int i=1;i<=13;i++){ if(cardNum.containsKey(i)){ int get = cardNum.get(i); if(get==2){ check_full=true; }else if(get==3){ check_full2=true; }else if(get==4){ return "NO HAND"; } } } if(check_full&&check_full2)return "FULL HOUSE"; if(!check_three&&check_three2)return "THREE CARD"; break; case 1: return "NO HAND"; } return null; } }