結果

問題 No.267 トランプソート
ユーザー itezpaceitezpace
提出日時 2016-09-12 09:20:44
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,754 bytes
コンパイル時間 578 ms
コンパイル使用メモリ 59,068 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-10 19:01:24
合計ジャッジ時間 1,804 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#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;
}
0