結果

問題 No.267 トランプソート
コンテスト
ユーザー Araki Tomohiro
提出日時 2017-05-25 21:39:16
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 696 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,531 ms
コンパイル使用メモリ 201,460 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2026-04-08 07:27:59
合計ジャッジ時間 2,606 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;

  vector<pair<string, string> > card;
  for (int i=0; i<n; i++) {
    string s, t="";
    cin >> s;
    if (s[0] == 'D') t += 'A';
    if (s[0] == 'C') t += 'B';
    if (s[0] == 'H') t += 'C';
    if (s[0] == 'S') t += 'D';

    if ('2' <= s[1] && s[1] <= '9') t += 'A' + (s[1]-'1');
    if (s[1] == 'A') t += 'A';
    if (s[1] == 'T') t += 'J';
    if (s[1] == 'J') t += 'K';
    if (s[1] == 'Q') t += 'L';
    if (s[1] == 'K') t += 'M';
    card.push_back(make_pair(t, s));
  }

  sort(card.begin(), card.end());

  for (int i=0; i<n; i++) {
    cout << card[i].second << " ";
  }
  cout << endl;

  return 0;
}
0