結果
| 問題 | 
                            No.267 トランプソート
                             | 
                    
| コンテスト | |
| ユーザー | 
                             tntan
                         | 
                    
| 提出日時 | 2015-12-15 04:03:59 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 819 bytes | 
| コンパイル時間 | 997 ms | 
| コンパイル使用メモリ | 82,996 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-09-15 12:59:34 | 
| 合計ジャッジ時間 | 1,838 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 5 WA * 15 | 
ソースコード
#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[0] - '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;
}
            
            
            
        
            
tntan