結果

問題 No.267 トランプソート
ユーザー soupesuteakasoupesuteaka
提出日時 2015-08-21 22:30:38
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,168 bytes
コンパイル時間 922 ms
コンパイル使用メモリ 94,864 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-25 14:47:13
合計ジャッジ時間 1,950 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 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 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 2 ms
4,384 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 <queue>
#include <string>
#include <cstring>
#include <cstdio>
#include <sstream>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#include <iomanip>

#define INF 1000000001
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
const double PI = acos(-1.0);

int N;
vector<pair<int, string> > v;

int toint(string s)
{
	int res=0;
	char m = s[0], n = s[1];
	switch(m) {
		case 'D': res=0; break;
		case 'C': res=100; break;
		case 'H': res=1000; break;
		case 'S': res=10000; break;
	}
	if (n=='A') res += 1;
	else if (n=='T') res += 10;
	else if (n=='J') res += 11;
	else if (n=='Q') res += 12;
	else if (n=='K') res += 13;
	else res += n-'0';

	return res;
}

int main()
{
	ios::sync_with_stdio(false);

	cin >> N;
	v.resize(N);
	FOR(i,0,N) cin >> v[i].second;
	FOR(i,0,N) v[i].first = toint(v[i].second);
	sort(v.begin(), v.end());
	FOR(i,0,N-1) cout << v[i].second << " ";
	cout << v[N-1].second << endl;

	return 0;
}
0