結果
問題 | No.267 トランプソート |
ユーザー | kuisiba |
提出日時 | 2016-05-03 22:15:56 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 2,631 bytes |
コンパイル時間 | 722 ms |
コンパイル使用メモリ | 69,072 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-05 06:01:09 |
合計ジャッジ時間 | 1,677 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,248 KB |
testcase_02 | AC | 2 ms
5,248 KB |
testcase_03 | AC | 2 ms
5,248 KB |
testcase_04 | AC | 2 ms
5,248 KB |
testcase_05 | AC | 2 ms
5,248 KB |
testcase_06 | AC | 1 ms
5,248 KB |
testcase_07 | AC | 2 ms
5,248 KB |
testcase_08 | AC | 2 ms
5,248 KB |
testcase_09 | AC | 2 ms
5,248 KB |
testcase_10 | AC | 2 ms
5,248 KB |
testcase_11 | AC | 2 ms
5,248 KB |
testcase_12 | AC | 2 ms
5,248 KB |
testcase_13 | AC | 2 ms
5,248 KB |
testcase_14 | AC | 2 ms
5,248 KB |
testcase_15 | AC | 2 ms
5,248 KB |
testcase_16 | AC | 2 ms
5,248 KB |
testcase_17 | AC | 2 ms
5,248 KB |
testcase_18 | AC | 1 ms
5,248 KB |
testcase_19 | AC | 1 ms
5,248 KB |
testcase_20 | AC | 2 ms
5,248 KB |
testcase_21 | AC | 2 ms
5,248 KB |
testcase_22 | AC | 2 ms
5,248 KB |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> diamonds; vector<int> clubs; vector<int> hearts; vector<int> spades; for (int i = 0; i < n; ++i) { char suit; char numC; int numI; string s; cin >> s; numC = s.at(1); if (numC == 'A') numI = 1; else if (numC == 'T') numI = 10; else if (numC == 'J') numI = 11; else if (numC == 'Q') numI = 12; else if (numC == 'K') numI = 13; else numI = numC - '0'; suit = s.at(0); if (suit == 'D') diamonds.push_back(numI); else if (suit == 'C') clubs.push_back(numI); else if (suit == 'H') hearts.push_back(numI); else spades.push_back(numI); } sort(diamonds.begin(), diamonds.end()); sort(clubs.begin(), clubs.end()); sort(hearts.begin(), hearts.end()); sort(spades.begin(), spades.end()); for (size_t i = 0; i < diamonds.size(); ++i) { if (diamonds.at(i) == 1) cout << "DA" << " "; else if (diamonds.at(i) == 10) cout << "DT" << " "; else if (diamonds.at(i) == 11) cout << "DJ" << " "; else if (diamonds.at(i) == 12) cout << "DQ" << " "; else if (diamonds.at(i) == 13) cout << "DK" << " "; else cout << "D" << diamonds.at(i) << " "; } for (size_t i = 0; i < clubs.size(); ++i) { if (clubs.at(i) == 1) cout << "CA" << " "; else if (clubs.at(i) == 10) cout << "CT" << " "; else if (clubs.at(i) == 11) cout << "CJ" << " "; else if (clubs.at(i) == 12) cout << "CQ" << " "; else if (clubs.at(i) == 13) cout << "CK" << " "; else cout << "C" << clubs.at(i) << " "; } for (size_t i = 0; i < hearts.size(); ++i) { if (hearts.at(i) == 1) cout << "HA" << " "; else if (hearts.at(i) == 10) cout << "HT" << " "; else if (hearts.at(i) == 11) cout << "HJ" << " "; else if (hearts.at(i) == 12) cout << "HQ" << " "; else if (hearts.at(i) == 13) cout << "HK" << " "; else cout << "H" << hearts.at(i) << " "; } for (size_t i = 0; i < spades.size(); ++i) { if (spades.at(i) == 1) cout << "SA" << " "; else if (spades.at(i) == 10) cout << "ST" << " "; else if (spades.at(i) == 11) cout << "SJ" << " "; else if (spades.at(i) == 12) cout << "SQ" << " "; else if (spades.at(i) == 13) cout << "SK" << " "; else cout << "S" << spades.at(i) << " "; } cout << endl; return 0; }