結果
| 問題 | No.227 簡単ポーカー |
| コンテスト | |
| ユーザー |
spacia
|
| 提出日時 | 2015-12-21 23:11:47 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 54 ms / 5,000 ms |
| コード長 | 989 bytes |
| コンパイル時間 | 2,251 ms |
| コンパイル使用メモリ | 77,744 KB |
| 実行使用メモリ | 37,148 KB |
| 最終ジャッジ日時 | 2024-09-18 18:10:40 |
| 合計ジャッジ時間 | 3,545 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 |
ソースコード
import java.io.*;
import java.util.*;
class Main227 {
public static void disp (Object obj) {
System.out.println(obj);
}
public static String solve (int[] hand) {
int cntTwo = 0, cntThree = 0;
int[] seq = new int[14];
for (int h : hand) seq[h]++;
for (int s : seq) {
if (s == 2) cntTwo++;
if (s == 3) cntThree++;
}
if (cntThree == 1 && cntTwo == 1) {
return "FULL HOUSE";
} else if (cntThree == 1 && cntTwo == 0) {
return "THREE CARD";
} else if (cntThree == 0 && cntTwo == 2) {
return "TWO PAIR";
} else if (cntThree == 0 && cntTwo == 1) {
return "ONE PAIR";
} else {
return "NO HAND";
}
}
public static void main (String[] args) throws IOException {
BufferedReader br =
new BufferedReader(new InputStreamReader(System.in));
String[] line = br.readLine().split(" ");
int[] hand = new int[line.length];
for (int i = 0; i < line.length; i++)
hand[i] = Integer.parseInt(line[i]);
disp(solve(hand));
}
}
spacia