結果

問題 No.227 簡単ポーカー
ユーザー ackyacky
提出日時 2024-02-01 18:56:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 38 ms / 5,000 ms
コード長 1,319 bytes
コンパイル時間 342 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 53,460 KB
最終ジャッジ日時 2024-02-01 18:56:56
合計ジャッジ時間 2,050 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

def main() -> None:

    # 整数の組み合わせを入力し、リストに入れる
    card_list = list(map(int, input().split()))

    # 自分を含めて、同じ整数の個数をそれぞれ数える
    count = []

    for i in range(5):
        count_card = 0
        for j in range(5):
            if card_list[i] == card_list[j]:
                count_card += 1
        count.append(count_card)

    # ペアがない整数とペアがあった整数を数える
    number_of_one = 0
    number_of_two = 0
    number_of_three = 0
    number_of_four = 0
    number_of_five = 0

    for i in count:
        if i == 1:
            number_of_one += 1
        elif i == 2:
            number_of_two += 1
        elif i == 3:
            number_of_three += 1
        elif i == 4:
            number_of_four += 1
        elif i == 5:
            number_of_five += 1

    # ペアの個数を元に役を判定する
    if number_of_one == 0 and number_of_two >= 1:
        print('FULL HOUSE')

    elif number_of_one == 5 or number_of_five == 5 or number_of_four == 4:
        print('NO HAND')

    elif number_of_one == 1:
        print('TWO PAIR')

    elif number_of_one == 2:
        print('THREE CARD')

    elif number_of_one == 3:
        print('ONE PAIR')

if __name__ == "__main__":
    main()
0