結果

問題 No.267 トランプソート
ユーザー tetsuzuki1115tetsuzuki1115
提出日時 2018-04-03 17:10:19
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,309 bytes
コンパイル時間 1,806 ms
コンパイル使用メモリ 103,116 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-08 15:29:05
合計ジャッジ時間 2,472 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    map<string,string> X;
    X["A"] = "1";
    X["T"] = "10";
    X["J"] = "11";
    X["Q"] = "12";
    X["K"] = "13";
    X["1"] = "A";
    X["10"] = "T";
    X["11"] = "J";
    X["12"] = "Q";
    X["13"] = "K";

    int N;
    cin >> N;
    vector< vector<int> > V(4);
    string S = "DCHS";
    for ( int i = 0; i < N; i++ ) {
        string s;
        cin >> s;        
        for ( int j = 0; j < 4; j++ ) {
            if ( S[j] == s[0] ) {
                s = s.substr(1,s.length()-1);
                if ( X[s].length() ) { s = X[s]; }
                V[j].push_back(stoi(s));
            }
        }
    }
    for ( int i = 0; i < 4; i++ ) {
        sort( V[i].begin(), V[i].end() );
        for ( int j = 0; j < V[i].size(); j++ ) {
            string s = to_string(V[i][j]);
            if ( X[s].length() ) { s = X[s]; }
            cout << S[i] << s;            
            if ( i != 3 || j != V[i].size()-1 ) { cout << " "; }
        }        
    }
    cout << endl;

    return 0;
}
0