結果

問題 No.267 トランプソート
ユーザー Lay_ecLay_ec
提出日時 2015-08-21 22:27:49
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,175 bytes
コンパイル時間 1,039 ms
コンパイル使用メモリ 99,768 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-25 14:37:46
合計ジャッジ時間 1,917 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,384 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,384 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
#include <queue>
#include <stack>
using namespace std;

int main(){
	int n;
	cin>>n;
	vector<int> d,c,h,s;
	
	map<char,int> c2i;
	map<int,char> i2c;
	for(int i=2;i<10;i++){
		c2i[i+'0']=i;
		i2c[i]=i+'0';
	}
	c2i['A']=1;
	c2i['T']=10;
	c2i['J']=11;
	c2i['Q']=12;
	c2i['K']=13;
	i2c[1]='A';
	i2c[10]='T';
	i2c[11]='J';	
	i2c[12]='Q';
	i2c[13]='K';

	for(int i=0;i<n;i++){
		string card;
		cin>>card;
		if(card[0]=='D') d.push_back(c2i[card[1]]);
		if(card[0]=='C') c.push_back(c2i[card[1]]);
		if(card[0]=='H') h.push_back(c2i[card[1]]);
		if(card[0]=='S') s.push_back(c2i[card[1]]);
	}
	
	sort(d.begin(),d.end());
	sort(c.begin(),c.end());
	sort(h.begin(),h.end());
	sort(s.begin(),s.end());
	
	for(int i=0;i<d.size();i++){
		cout<<"D"<<i2c[d[i]]<<" ";
	}
	for(int i=0;i<c.size();i++){
		cout<<"C"<<i2c[c[i]]<<" ";
	}
	for(int i=0;i<h.size();i++){
		cout<<"H"<<i2c[h[i]]<<" ";
	}
	for(int i=0;i<s.size();i++){
		cout<<"S"<<i2c[s[i]]<<" ";
	}
	cout<<endl;
}
0