結果
| 問題 |
No.227 簡単ポーカー
|
| コンテスト | |
| ユーザー |
bigbear90560
|
| 提出日時 | 2015-07-22 21:48:10 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 125 ms / 5,000 ms |
| コード長 | 1,530 bytes |
| コンパイル時間 | 3,306 ms |
| コンパイル使用メモリ | 79,196 KB |
| 実行使用メモリ | 56,024 KB |
| 最終ジャッジ日時 | 2024-07-08 12:00:52 |
| 合計ジャッジ時間 | 6,020 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 |
ソースコード
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
/**
* No.227 簡単ポーカー
*/
public class SimplePoker {
public static void main(String[] args) {
// 標準入力から読み込む際に、Scannerオブジェクトを使う。
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int d = sc.nextInt();
int e = sc.nextInt();
List<Integer> list = new ArrayList<Integer>();
list.add(a);
list.add(b);
list.add(c);
list.add(d);
list.add(e);
Collections.sort(list);
int cnt[] = {1,1,1,1,1};
int idx = 0;
int value = list.get(0);
for (int i=1; i<list.size(); i++) {
if (value == list.get(i)) {
cnt[idx]++;
} else {
value = list.get(i);
idx++;
}
}
String str = "";
if ((cnt[0] == 3 && cnt[1] == 2) || (cnt[0] == 2 && cnt[1] == 3)) {
str = "FULL HOUSE";
} else if (cnt[0] == 3 || cnt[1] == 3 || cnt[2] == 3 ) {
str = "THREE CARD";
} else if ((cnt[0] == 2 && cnt[1] == 2) || (cnt[0] == 2 && cnt[2] == 2) || (cnt[1] == 2 && cnt[2] == 2)) {
str = "TWO PAIR";
} else if (cnt[0] == 2 || cnt[1] == 2 || cnt[2] == 2 || cnt[3] == 2) {
str = "ONE PAIR";
} else {
str = "NO HAND";
}
System.out.println(str);
}
}
bigbear90560