結果
| 問題 |
No.227 簡単ポーカー
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-10-22 00:47:57 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,773 bytes |
| コンパイル時間 | 311 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2024-10-22 00:47:58 |
| 合計ジャッジ時間 | 1,408 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 WA * 3 |
ソースコード
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
if card_dict[ele] == 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()