結果
問題 | No.227 簡単ポーカー |
ユーザー |
|
提出日時 | 2017-02-27 14:12:04 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 130 ms / 5,000 ms |
コード長 | 1,085 bytes |
コンパイル時間 | 2,187 ms |
コンパイル使用メモリ | 74,448 KB |
実行使用メモリ | 54,312 KB |
最終ジャッジ日時 | 2024-06-11 19:23:24 |
合計ジャッジ時間 | 4,502 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int[] card = new int[5]; int[] num = new int[14]; //初期値は0 for(int i=0;i<card.length;i++){ card[i] = scanner.nextInt(); num[card[i]] += 1; } int count2 = 0; int count3 = 0; //探索 for(int i=1;i<num.length;i++){ if(num[i] == 2){ count2++; }else if(num[i] == 3){ count3++; } } if(count3 == 1 && count2 == 1){ System.out.println("FULL HOUSE"); }else if(count3 == 1){ System.out.println("THREE CARD"); }else if(count2 == 2){ System.out.println("TWO PAIR"); }else if(count2 == 1){ System.out.println("ONE PAIR"); }else{ System.out.println("NO HAND"); } } }