結果
| 問題 | No.227 簡単ポーカー | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-10-22 00:48:54 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 42 ms / 5,000 ms | 
| コード長 | 1,790 bytes | 
| コンパイル時間 | 367 ms | 
| コンパイル使用メモリ | 12,928 KB | 
| 実行使用メモリ | 11,008 KB | 
| 最終ジャッジ日時 | 2024-10-22 00:48:56 | 
| 合計ジャッジ時間 | 1,993 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 14 | 
ソースコード
def main():
    a_lst = list(map(int, input().split(' ')))
    if judge_full_house(a_lst):
        print('FULL HOUSE')
    elif judge_3_card(a_lst):
        print('THREE CARD')
    elif judge_2_pair(a_lst):
        print('TWO PAIR')
    elif judge_1_pair(a_lst):
        print('ONE PAIR')
    else:
        print('NO HAND')
def judge_full_house(lst):
    card_dict = {}
    for ele in lst:
        if ele not in card_dict.keys():
            card_dict[ele] = 1
        else:
            card_dict[ele] += 1
    
    isExist3 = False
    isExist2 = False
    for val in card_dict.values():
        if not isExist3 and val == 3:
            isExist3 = True
        elif not isExist2 and val == 2:
            isExist2 = True
    if isExist2 and isExist3:
        return True
    else:
        return False
def judge_3_card(lst):
    card_dict = {}
    for ele in lst:
        if ele not in card_dict.keys():
            card_dict[ele] = 1
        else:
            card_dict[ele] += 1
    for val in card_dict.values():
        if val == 3:
            return True
    return False
def judge_2_pair(lst):
    card_dict = {}
    for ele in lst:
        if ele not in card_dict.keys():
            card_dict[ele] = 1
        else:
            card_dict[ele] += 1
    isFirst2 = False
    for val in card_dict.values():
        if val == 2 and not isFirst2:
            isFirst2 = True
        elif val == 2 and isFirst2:
            return True
    return False
def judge_1_pair(lst):
    card_dict = {}
    for ele in lst:
        if ele not in card_dict.keys():
            card_dict[ele] = 1
        else:
            card_dict[ele] += 1
    for val in card_dict.values():
        if val == 2:
            return True
    return False
if __name__ == '__main__':
    main()
            
            
            
        