結果

問題 No.227 簡単ポーカー
ユーザー しのっちしのっち
提出日時 2019-05-09 13:16:30
言語 PHP
(8.3.4)
結果
AC  
実行時間 8 ms / 5,000 ms
コード長 498 bytes
コンパイル時間 521 ms
コンパイル使用メモリ 11,976 KB
実行使用メモリ 12,236 KB
最終ジャッジ日時 2023-09-14 17:42:04
合計ジャッジ時間 1,012 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
12,224 KB
testcase_01 AC 7 ms
12,180 KB
testcase_02 AC 8 ms
12,120 KB
testcase_03 AC 7 ms
12,224 KB
testcase_04 AC 7 ms
12,144 KB
testcase_05 AC 7 ms
12,156 KB
testcase_06 AC 7 ms
12,232 KB
testcase_07 AC 7 ms
12,200 KB
testcase_08 AC 7 ms
12,168 KB
testcase_09 AC 7 ms
12,160 KB
testcase_10 AC 7 ms
12,236 KB
testcase_11 AC 7 ms
12,192 KB
testcase_12 AC 7 ms
12,136 KB
testcase_13 AC 7 ms
12,124 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$hand = explode(" ", trim(fgets(STDIN)));
$card_count = array_count_values($hand);

$pair_count = 0;
$three_card_count = 0;

foreach ($card_count as $key => $num) {
  if ($num == 2) $pair_count++;
  if ($num == 3) $three_card_count++;
}

if ($three_card_count == 1 && $pair_count == 1) echo "FULL HOUSE\n";
elseif ($three_card_count == 1 && $pair_count == 0) echo "THREE CARD\n";
elseif ($pair_count == 2) echo "TWO PAIR\n";
elseif ($pair_count == 1) echo "ONE PAIR\n";
else echo "NO HAND\n";
0