結果

問題 No.227 簡単ポーカー
ユーザー polygon283polygon283
提出日時 2023-09-05 06:47:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 870 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 10,776 KB
実行使用メモリ 7,976 KB
最終ジャッジ日時 2023-09-05 06:47:25
合計ジャッジ時間 1,130 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 16 ms
7,844 KB
testcase_02 AC 16 ms
7,884 KB
testcase_03 AC 16 ms
7,792 KB
testcase_04 AC 16 ms
7,836 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 16 ms
7,800 KB
testcase_08 WA -
testcase_09 AC 16 ms
7,848 KB
testcase_10 AC 16 ms
7,924 KB
testcase_11 AC 15 ms
7,768 KB
testcase_12 AC 16 ms
7,912 KB
testcase_13 AC 16 ms
7,828 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def count_cards(cards):
    card_count = {}
    
    for card in cards:
        if card in card_count:
            card_count[card] += 1
        else:
            card_count[card] = 1
    return card_count

def check_cards(cards):
    card_count = count_cards(cards)
    counts = list(card_count.values())
    
    # "FULL HOUSE"の判定を"THREE CARD"の前に行う
    if counts.count(3) == 1 and counts.count(2) == 1:
        return "FULL HOUSE"
    if counts.count(3) == 1:
        return "THREE CARD"
    if counts.count(2) == 2:
        return "TWO PAIR"
    if counts.count(2) == 1:
        return "ONE PAIR"
    # "NO PAIR"を返すように修正
    return "NO PAIR"

input_card = input()
split_card = input_card.split()
cards = [int(card) for card in split_card]  # リスト内包表記を使ってシンプルに
result = check_cards(cards)
print(result)
0