結果
| 問題 |
No.227 簡単ポーカー
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-17 00:50:34 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 1,260 bytes |
| コンパイル時間 | 1,726 ms |
| コンパイル使用メモリ | 67,456 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-14 22:46:39 |
| 合計ジャッジ時間 | 1,408 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 |
コンパイルメッセージ
In file included from /usr/include/c++/11/bits/char_traits.h:39,
from /usr/include/c++/11/ios:40,
from /usr/include/c++/11/ostream:38,
from /usr/include/c++/11/iostream:39,
from main.cpp:1:
In static member function ‘static _Tp* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(const _Tp*, const _Tp*, _Tp*) [with _Tp = int; bool _IsMove = false]’,
inlined from ‘_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = false; _II = const int*; _OI = int*]’ at /usr/include/c++/11/bits/stl_algobase.h:495:30,
inlined from ‘_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = false; _II = const int*; _OI = int*]’ at /usr/include/c++/11/bits/stl_algobase.h:522:42,
inlined from ‘_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = false; _II = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; _OI = int*]’ at /usr/include/c++/11/bits/stl_algobase.h:529:31,
inlined from ‘_OI std::copy(_II, _II, _OI) [with _II = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; _OI = int*]’ at /usr/include/c++/11/bits/stl_algobase.h:620:7,
inlined from ‘static _ForwardIterator std::__uninitialized_copy<true>::__uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; _ForwardIterator = int*]’ at /usr/include/c++/11/bits/stl_uninitialized.h:110:27,
inlined from ‘_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int> >; _ForwardIterator = int*]’ at /usr/include/c++/11/bits/stl_uninitialized.h:151:15,
inlined from ‘_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = __gnu_cxx::__normal_iterator<const int*, std::vector<int>
ソースコード
#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;
}