結果

問題 No.227 簡単ポーカー
ユーザー papinianuspapinianus
提出日時 2016-06-17 15:14:34
言語 PHP
(8.3.4)
結果
AC  
実行時間 49 ms / 5,000 ms
コード長 586 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 32,404 KB
実行使用メモリ 31,316 KB
最終ジャッジ日時 2024-04-17 23:07:47
合計ジャッジ時間 1,552 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
31,228 KB
testcase_01 AC 49 ms
31,076 KB
testcase_02 AC 49 ms
31,068 KB
testcase_03 AC 44 ms
30,960 KB
testcase_04 AC 42 ms
31,000 KB
testcase_05 AC 42 ms
31,100 KB
testcase_06 AC 41 ms
31,216 KB
testcase_07 AC 42 ms
31,104 KB
testcase_08 AC 41 ms
30,732 KB
testcase_09 AC 41 ms
31,068 KB
testcase_10 AC 42 ms
30,804 KB
testcase_11 AC 43 ms
30,876 KB
testcase_12 AC 42 ms
31,316 KB
testcase_13 AC 41 ms
31,148 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$hands = ['FULL HOUSE', 'THREE CARD', 'TWO PAIR', 'ONE PAIR', 'NO HAND'];
$nums = array_fill(1, 13, 0);
$mine = explode(' ',trim(fgets(STDIN)));
foreach($mine as $card) {
    $nums[$card]++;
}
$threes = 0;
$pair = 0;
foreach($nums as $num) {
    if($num == 3) {
        $threes++;
    } else if($num == 2){
        $pair++;
    }
}
if($threes) {
    if($pair) {
        echo $hands[0];
    } else {
        echo $hands[1];
    }
} else if($pair) {
    if($pair == 2) {
        echo $hands[2];
    } else {
        echo $hands[3];
    }
} else {
    echo $hands[4];
}
echo PHP_EOL;
0