結果
問題 | No.227 簡単ポーカー |
ユーザー | TEWi_R |
提出日時 | 2017-12-17 00:50:34 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 1,260 bytes |
コンパイル時間 | 849 ms |
コンパイル使用メモリ | 69,184 KB |
実行使用メモリ | 4,384 KB |
最終ジャッジ日時 | 2023-08-21 11:48:57 |
合計ジャッジ時間 | 1,454 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,380 KB |
testcase_02 | AC | 1 ms
4,384 KB |
testcase_03 | AC | 1 ms
4,380 KB |
testcase_04 | AC | 1 ms
4,380 KB |
testcase_05 | AC | 1 ms
4,376 KB |
testcase_06 | AC | 2 ms
4,384 KB |
testcase_07 | AC | 1 ms
4,380 KB |
testcase_08 | AC | 1 ms
4,380 KB |
testcase_09 | AC | 1 ms
4,380 KB |
testcase_10 | AC | 1 ms
4,380 KB |
testcase_11 | AC | 2 ms
4,380 KB |
testcase_12 | AC | 2 ms
4,380 KB |
testcase_13 | AC | 1 ms
4,376 KB |
ソースコード
#include <iostream> #include <algorithm> #include <vector> using namespace std; void printVector(vector<int> v, string delimiter){ for(int i = 0; i < v.size(); ++i){ if(i != 0) cout << delimiter; cout << v[i]; } cout << '\n'; } int countMaxCard(vector<int> cards, vector<int> u_cards){ int count = 0; for(auto e_card: u_cards){ int tmp_count = 0; for(auto card: cards){ if(card == e_card) tmp_count++; } if(tmp_count > count) count = tmp_count; } return count; } int main(){ vector<int> cards(5),u_cards(5); for(auto&& card: cards) cin >> card; sort(cards.begin(), cards.end()); u_cards = cards; u_cards.erase(unique(u_cards.begin(), u_cards.end()), u_cards.end()); int cards_e = u_cards.size(); if(cards_e == 5){ puts("NO HAND"); } else if(cards_e == 4){ puts("ONE PAIR"); } else if(cards_e == 3){ int cnt = countMaxCard(cards, u_cards); if(cnt == 3) puts("THREE CARD"); if(cnt == 2) puts("TWO PAIR"); } else if(cards_e == 2){ if(countMaxCard(cards, u_cards) == 3) puts("FULL HOUSE"); else puts("NO HAND"); } else { puts("NO HAND"); } return 0; }