結果
| 問題 |
No.227 簡単ポーカー
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-10-24 11:56:22 |
| 言語 | Java (openjdk 23) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,150 bytes |
| コンパイル時間 | 4,045 ms |
| コンパイル使用メモリ | 77,996 KB |
| 実行使用メモリ | 37,276 KB |
| 最終ジャッジ日時 | 2024-11-21 17:35:40 |
| 合計ジャッジ時間 | 5,602 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 RE * 4 |
ソースコード
import java.io.*;
import java.util.Arrays;
public class No227{
public static void main(String[] args) throws IOException{
String[] str = new BufferedReader(new InputStreamReader(System.in)).readLine().split(" ");
int[] hand = new int[13];
int[] strToInt = new int[str.length];
for(int i=0; i < str.length; i++) strToInt[i] = Integer.parseInt(str[i]);
for(int i=0; i < str.length; i++) hand[strToInt[i]]++;
Arrays.sort(hand);
reverse(hand);
judge(hand);
}
public static void reverse(int[] a){
int temp = 0;
for(int i=0; i < a.length / 2; i++){
temp = a[i];
a[i] = a[a.length - 1 - i];
a[a.length - 1 - i] = temp;
}
}
public static void judge(int[] a){
if(a[0] == 3){
if(a[1] == 2) System.out.println("FULL HOUSE");
else System.out.println("THREE CARD");
}
else if(a[0] == 2){
if(a[1] == 2) System.out. println("TWO PAIR");
else System.out.println("ONE PAIR");
}
else System.out.println("NO HAND");
}
}