結果

問題 No.227 簡単ポーカー
ユーザー cmycmy
提出日時 2022-07-04 20:44:48
言語 Bash
(Bash 5.1.16)
結果
AC  
実行時間 16 ms / 5,000 ms
コード長 429 bytes
コンパイル時間 68 ms
コンパイル使用メモリ 5,384 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-21 05:00:39
合計ジャッジ時間 1,303 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
外部呼び出し有り
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
4,380 KB
testcase_01 AC 16 ms
4,384 KB
testcase_02 AC 15 ms
4,380 KB
testcase_03 AC 16 ms
4,380 KB
testcase_04 AC 16 ms
4,384 KB
testcase_05 AC 15 ms
4,380 KB
testcase_06 AC 15 ms
4,380 KB
testcase_07 AC 15 ms
4,380 KB
testcase_08 AC 15 ms
4,376 KB
testcase_09 AC 15 ms
4,384 KB
testcase_10 AC 15 ms
4,376 KB
testcase_11 AC 15 ms
4,376 KB
testcase_12 AC 16 ms
4,380 KB
testcase_13 AC 15 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env BASH_ENV=.to_gnu bash -O expand_aliases -eo pipefail

readonly cards=($(cat - | tr ' ' '\n' | sort -nrk1 | uniq -c | awk '{print $1}' | sort -nrk1))
if [[ ${#cards[@]} = 2 ]] && [[ ${cards[0]} = 3 ]]; then
  echo FULL HOUSE
elif [[ ${#cards[@]} = 3 ]]; then
  if [[ ${cards[0]} = 3 ]]; then
    echo THREE CARD
  else
    echo TWO PAIR
  fi
elif [[ ${#cards[@]} = 4 ]]; then
  echo ONE PAIR
else
  echo NO HAND
fi
0