結果
問題 | No.227 簡単ポーカー |
ユーザー | S Y |
提出日時 | 2024-10-22 00:48:54 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
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 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 34 ms
11,008 KB |
testcase_01 | AC | 37 ms
11,008 KB |
testcase_02 | AC | 34 ms
10,880 KB |
testcase_03 | AC | 34 ms
10,880 KB |
testcase_04 | AC | 35 ms
10,880 KB |
testcase_05 | AC | 34 ms
10,880 KB |
testcase_06 | AC | 33 ms
10,752 KB |
testcase_07 | AC | 36 ms
10,752 KB |
testcase_08 | AC | 36 ms
11,008 KB |
testcase_09 | AC | 34 ms
10,880 KB |
testcase_10 | AC | 34 ms
10,880 KB |
testcase_11 | AC | 35 ms
10,880 KB |
testcase_12 | AC | 42 ms
11,008 KB |
testcase_13 | AC | 35 ms
11,008 KB |
ソースコード
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()