結果
問題 | No.267 トランプソート |
ユーザー |
![]() |
提出日時 | 2015-12-15 04:08:30 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 818 bytes |
コンパイル時間 | 914 ms |
コンパイル使用メモリ | 83,300 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-15 12:59:38 |
合計ジャッジ時間 | 1,718 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include<iostream>#include<string>#include<fstream>#include<iomanip>#include<vector>#include<cctype>#include<algorithm>using namespace std;static const int MAX_N = 1000005;int main(){int n;string s;vector < pair<pair<int, int>, string > >v;cin >> n;for (int i = 0; i < n; i++){cin >> s;int p, q;if (s[0] == 'D')p = 0;else if (s[0] == 'C')p = 1;else if (s[0] == 'H')p = 2;else p = 3;if (isdigit(s[1]))q = static_cast<int>(s[1] - '0');else if (s[1] == 'A')q = 1;else if (s[1] == 'T')q = 10;else if (s[1] == 'J')q = 11;else if (s[1] == 'Q')q = 12;else q = 13;v.push_back(make_pair(make_pair(p, q), s));}sort(v.begin(), v.end());for (int i = 0; i < n; i++){if (i)cout << " " << v[i].second;else cout << v[i].second;}cout << endl;return 0;}