結果

問題 No.267 トランプソート
ユーザー glretoglreto
提出日時 2021-01-23 19:01:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,613 bytes
コンパイル時間 1,408 ms
コンパイル使用メモリ 87,612 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-30 03:34:05
合計ジャッジ時間 1,872 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<iomanip>
#include<map>
#include<queue>
#include<set>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define req(i,n) for(int i = 1;i <=  n; i++)
#define rrep(i,n) for(ll i = n-1;i >= 0;i--)
#define ALL(obj) begin(obj), end(obj)
#define RALL(a) rbegin(a),rend(a)
typedef long long ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;
ll mod = 1e9 + 7;
int main() {
    int n; cin >> n; vector<int> a;
    char c, d;
    rep(i, n) {
        cin >> c >> d;
        int num = 0;
        if (c == 'D')num += 100;
        else if (c == 'C')num += 200;
        else if (c == 'H')num += 300;
        else num += 400;
        if (d == 'A') num += 1;
        else if (d == 'T') num += 10;
        else if (d == 'J') num += 11;
        else if (d == 'Q') num += 12;
        else if (d == 'K') num += 13;
        else num += (int)(d - '0');
        a.push_back(num);
    }sort(ALL(a));
    for (int i : a) {
        if (i / 100 == 1) cout << "D";
        else if (i / 100 == 2)cout << "C";
        else if (i / 100 == 3)cout << "H";
        else cout << "S";
        if (i % 100 == 10)cout << "T ";
        else if (i % 100 == 11)cout << "J ";
        else if (i % 100 == 12)cout << "Q ";
        else if (i % 100 == 13)cout << "K ";
        else if (i % 10 == 1)cout << "A ";
        else cout << i % 10 << " ";
    }cout << endl;
}
0