結果

問題 No.267 トランプソート
ユーザー fiordfiord
提出日時 2015-08-21 23:40:40
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,115 bytes
コンパイル時間 1,666 ms
コンパイル使用メモリ 151,008 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-09-25 15:34:50
合計ジャッジ時間 2,826 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;	cin>>n;
	string s;
	vector<int> lst(n);
	for(int i=0;i<n;i++){
		cin>>s;
		if(s[0]=='D')	lst[i]=0;
		else if(s[0]=='C')	lst[i]=13;
		else if(s[0]=='H')	lst[i]=26;
		else if(s[0]=='S')	lst[i]=39;
		string num(s,1,1);
		if((int)s.size()==3)	num+=s[2];
		if(num=="2")	lst[i]+=1;
		else if(num=="3")	lst[i]+=2;
		else if(num=="4")	lst[i]+=3;
		else if(num=="5")	lst[i]+=4;
		else if(num=="6")	lst[i]+=5;
		else if(num=="7")	lst[i]+=6;
		else if(num=="8")	lst[i]+=7;
		else if(num=="9")	lst[i]+=8;
		else if(num=="T")	lst[i]+=9;
		else if(num=="J")	lst[i]+=10;
		else if(num=="Q")	lst[i]+=11;
		else if(num=="K")	lst[i]+=12;
	}
	sort(lst.begin(),lst.end());
	for(int i=0;i<n;i++){
		if(i>0)	cout<<" ";
		if(lst[i]/13==0)	cout<<"D";
		else if(lst[i]/13==1)	cout<<"C";
		else if(lst[i]/13==2)	cout<<"H";
		else 	cout<<"S";
		lst[i]/=13;
		if(1<lst[i]&&lst[i]<9)	cout<<lst[i]+1;
		else if(lst[i]==0)	cout<<"A";
		else if(lst[i]==9)	cout<<"T";
		else if(lst[i]==10)	cout<<"J";
		else if(lst[i]==11)	cout<<"Q";
		else 	cout<<"K";
	}
	cout<<endl;
	return 0;
}
0