結果
問題 | No.227 簡単ポーカー |
ユーザー |
![]() |
提出日時 | 2015-12-18 15:48:38 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 54 ms / 5,000 ms |
コード長 | 1,153 bytes |
コンパイル時間 | 2,051 ms |
コンパイル使用メモリ | 77,036 KB |
実行使用メモリ | 37,128 KB |
最終ジャッジ日時 | 2024-09-16 08:36:47 |
合計ジャッジ時間 | 3,547 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 |
ソースコード
package yukicoder; import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { BufferedReader read = new BufferedReader(new InputStreamReader(System.in)); try { String[] box = read.readLine().split(" "); int[] num = new int[5]; for (int i = 0; i < 5; ++i) { num[i] = Integer.parseInt(box[i]); } int[] count = new int[5]; for (int i = 0; i < 5; ++i) { for (int j = 0; j < 5; ++j) { if (i != j) { if (num[i] == num[j]) { count[i]++; } } } } boolean th = false, tw = false; int twCount = 0; for (int i = 0; i < 5; ++i) { if (count[i] == 2) { th = true; } else if (count[i] == 1) { tw = true; twCount++; } } if (th && tw) { System.out.println("FULL HOUSE"); } else if (th) { System.out.println("THREE CARD"); } else if (tw && twCount == 4) { System.out.println("TWO PAIR"); } else if (tw && twCount == 2) { System.out.println("ONE PAIR"); } else { System.out.println("NO HAND"); } } catch (Exception e) { e.printStackTrace(); } } }