結果
| 問題 |
No.267 トランプソート
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-09-12 09:20:44 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 1,754 bytes |
| コンパイル時間 | 481 ms |
| コンパイル使用メモリ | 59,124 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-17 03:49:16 |
| 合計ジャッジ時間 | 1,448 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int ary[4][13];
int main(){
int n;
cin>>n;
for(int i=0; i<n; ++i){
string s;
cin>>s;
char a=s[1];
int b=0;
if(a=='A'){
b=1;
} else if(a=='T'){
b=10;
} else if(a=='J'){
b=11;
} else if(a=='Q'){
b=12;
} else if(a=='K'){
b=13;
} else {
b=a-'0';
}
char c=s[0];
if(c=='D'){
ary[0][b-1]=1;
} else if(c=='C'){
ary[1][b-1]=1;
} else if(c=='H'){
ary[2][b-1]=1;
} else if(c=='S'){
ary[3][b-1]=1;
}
}
int f=0;
for(int i=0; i<4; ++i){
for(int j=0; j<13; ++j){
if(ary[i][j]==1){
string s2;
char d;
if(j+1==1){
d='A';
} else if(j+1==10){
d='T';
} else if(j+1==11){
d='J';
} else if(j+1==12){
d='Q';
} else if(j+1==13){
d='K';
} else {
d=j+1+'0';
}
if(i==0){
s2+='D';
s2+=d;
if(f==0){
cout<<s2;
f=1;
} else {
cout<<" "<<s2;
}
} else if(i==1){
s2+='C';
s2+=d;
if(f==0){
cout<<s2;
f=1;
} else {
cout<<" "<<s2;
}
} else if(i==2){
s2+='H';
s2+=d;
if(f==0){
cout<<s2;
f=1;
} else {
cout<<" "<<s2;
}
} else if(i==3){
s2+='S';
s2+=d;
if(f==0){
cout<<s2;
f=1;
} else {
cout<<" "<<s2;
}
}
}
}
}
cout<<endl;
return 0;
}