結果
| 問題 |
No.267 トランプソート
|
| コンテスト | |
| ユーザー |
hirokazu1020
|
| 提出日時 | 2015-08-21 23:12:34 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 1,242 bytes |
| コンパイル時間 | 898 ms |
| コンパイル使用メモリ | 92,516 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-18 12:08:59 |
| 合計ジャッジ時間 | 1,632 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:49:22: warning: ‘a’ may be used uninitialized in this function [-Wmaybe-uninitialized]
49 | char a,b;
| ^
ソースコード
#include<sstream>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<cctype>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())
#define indexOf(v,x) (find(all(v),x)-v.begin())
int main(){
int n;
vector<string> v;
cin>>n;
rep(i,n){
string s;
cin>>s;
if(s[0]=='D')s[0]='0';
else if(s[0]=='C')s[0]='1';
else if(s[0]=='H')s[0]='2';
else if(s[0]=='S')s[0]='3';
if(s[1]=='A')s[1]='1';
else if(s[1]=='T')s[1]='0'+10;
else if(s[1]=='J')s[1]='0'+11;
else if(s[1]=='Q')s[1]='0'+12;
else if(s[1]=='K')s[1]='0'+13;
v.push_back(s);
}
sort(all(v));
rep(i,n){
if(i)cout<<' ';
string &s=v[i];
char a,b;
if(s[0]=='0')a='D';
else if(s[0]=='1')a='C';
else if(s[0]=='2')a='H';
else if(s[0]=='3')a='S';
b=s[1];
if(b=='1')b='A';
else if('9'<b){
b-='0';
if(b==10)b='T';
else if(b==11)b='J';
else if(b==12)b='Q';
else if(b==13)b='K';
}
cout<<a<<b;
}
cout<<endl;
return 0;
}
hirokazu1020