結果

問題 No.227 簡単ポーカー
ユーザー sorchsorch
提出日時 2020-12-29 19:02:30
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 610 bytes
コンパイル時間 2,653 ms
コンパイル使用メモリ 30,960 KB
実行使用メモリ 31,376 KB
最終ジャッジ日時 2024-04-15 19:09:32
合計ジャッジ時間 4,026 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 38 ms
31,068 KB
testcase_02 AC 37 ms
31,332 KB
testcase_03 AC 36 ms
30,900 KB
testcase_04 AC 37 ms
31,308 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 36 ms
30,932 KB
testcase_08 WA -
testcase_09 AC 37 ms
30,892 KB
testcase_10 AC 38 ms
31,016 KB
testcase_11 AC 39 ms
31,184 KB
testcase_12 AC 38 ms
30,956 KB
testcase_13 AC 37 ms
31,212 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php

/**
 * @see https://yukicoder.me/problems/no/227
 */

$input = explode(" ", trim(fgets(STDIN)));

$cntCards = array_count_values($input);
$cntCmbi = array_count_values($cntCards);

$hasSame3Cards = array_key_exists(3, $cntCmbi);
$hasSame2Cards = array_key_exists(2, $cntCmbi);

if ($hasSame3Cards) {
    $ret = ($hasSame2Cards) ? 'FULL HOUSE' : 'THREE CARD';
} elseif ($hasSame2Cards) {
    switch ($cntCmbi[2]) {
        case 2:
            $ret = 'TWO PAIR';
            break;
        case 1:
            $ret = 'ONE PAIR';
            break;
    }
} else {
    $ret = 'NO PAIR';
}

echo $ret . "\n";
0