結果

問題 No.227 簡単ポーカー
ユーザー sorchsorch
提出日時 2020-12-29 19:04:43
言語 PHP
(8.3.4)
結果
AC  
実行時間 43 ms / 5,000 ms
コード長 610 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 31,308 KB
実行使用メモリ 31,556 KB
最終ジャッジ日時 2024-04-15 19:12:07
合計ジャッジ時間 1,472 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
31,076 KB
testcase_01 AC 43 ms
30,972 KB
testcase_02 AC 42 ms
30,892 KB
testcase_03 AC 42 ms
31,556 KB
testcase_04 AC 42 ms
31,452 KB
testcase_05 AC 42 ms
31,388 KB
testcase_06 AC 42 ms
31,116 KB
testcase_07 AC 42 ms
31,204 KB
testcase_08 AC 43 ms
31,336 KB
testcase_09 AC 41 ms
31,056 KB
testcase_10 AC 43 ms
31,272 KB
testcase_11 AC 42 ms
31,396 KB
testcase_12 AC 42 ms
31,040 KB
testcase_13 AC 43 ms
31,076 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 HAND';
}

echo $ret . "\n";
0