結果
問題 | No.227 簡単ポーカー |
ユーザー | きつねうどん |
提出日時 | 2023-11-24 21:36:28 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 155 ms / 5,000 ms |
コード長 | 1,529 bytes |
コンパイル時間 | 3,445 ms |
コンパイル使用メモリ | 79,060 KB |
実行使用メモリ | 58,100 KB |
最終ジャッジ日時 | 2023-11-24 21:36:35 |
合計ジャッジ時間 | 5,194 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 128 ms
58,092 KB |
testcase_01 | AC | 153 ms
57,976 KB |
testcase_02 | AC | 125 ms
58,088 KB |
testcase_03 | AC | 114 ms
56,832 KB |
testcase_04 | AC | 127 ms
58,100 KB |
testcase_05 | AC | 126 ms
58,092 KB |
testcase_06 | AC | 127 ms
58,088 KB |
testcase_07 | AC | 128 ms
57,984 KB |
testcase_08 | AC | 128 ms
57,952 KB |
testcase_09 | AC | 155 ms
57,960 KB |
testcase_10 | AC | 114 ms
56,808 KB |
testcase_11 | AC | 127 ms
58,092 KB |
testcase_12 | AC | 126 ms
57,952 KB |
testcase_13 | AC | 127 ms
58,088 KB |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int a = scanner.nextInt(); int b = scanner.nextInt(); int c = scanner.nextInt(); int d = scanner.nextInt(); int e = scanner.nextInt(); int[] list = {a, b, c, d, e}; Arrays.sort(list); // System.out.println(Arrays.toString(list)); List<Integer> countList = new ArrayList<Integer>(); int prev = 0; int count = 1; for (int i = 0; i < 5; i++) { if (i != 0) { if (prev == list[i]) { count++; } else { countList.add(count); count = 1; } } prev = list[i]; } countList.add(count); // System.out.println(countList); if (countList.contains(3)) { if (countList.contains(2)) { System.out.println("FULL HOUSE"); } else { System.out.println("THREE CARD"); } } else { if (countList.contains(2)) { int twoNum = Collections.frequency(countList, 2); if (twoNum == 2) { System.out.println("TWO PAIR"); } else { System.out.println("ONE PAIR"); } } else { System.out.println("NO HAND"); } } } }