結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 36 ms
31,160 KB
testcase_02 AC 39 ms
30,980 KB
testcase_03 AC 35 ms
30,928 KB
testcase_04 AC 40 ms
30,832 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 37 ms
31,240 KB
testcase_08 WA -
testcase_09 AC 36 ms
31,028 KB
testcase_10 AC 37 ms
31,064 KB
testcase_11 AC 37 ms
30,984 KB
testcase_12 AC 39 ms
31,268 KB
testcase_13 AC 37 ms
31,204 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