結果
問題 | No.267 トランプソート |
ユーザー |
![]() |
提出日時 | 2015-08-24 03:37:00 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 636 bytes |
コンパイル時間 | 639 ms |
コンパイル使用メモリ | 69,548 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-18 13:07:11 |
合計ジャッジ時間 | 1,262 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include <iostream> #include <map> #include <string> using namespace std; int main() { int n; cin >> n; map<pair<int, int>, string> cards; for (int i = 0; i < n; ++i) { string mn; cin >> mn; int mark = mn[0] == 'D' ? 0 : mn[0] == 'C' ? 1 : mn[0] == 'H' ? 2 : 3; int number = mn[1] == 'A' ? 1 : mn[1] == 'T' ? 10 : mn[1] == 'J' ? 11 : mn[1] == 'Q' ? 12 : mn[1] == 'K' ? 13 : (int)(mn[1] - '0'); cards[make_pair(mark, number)] = mn; } for (map<pair<int, int>, string>::const_iterator it = cards.begin(); it != cards.end(); ++it) { cout << it->second << " "; } cout << flush; return 0; }