結果
| 問題 |
No.267 トランプソート
|
| コンテスト | |
| ユーザー |
soupesuteaka
|
| 提出日時 | 2015-08-21 22:30:38 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 1,168 bytes |
| コンパイル時間 | 973 ms |
| コンパイル使用メモリ | 95,544 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-18 11:37:43 |
| 合計ジャッジ時間 | 1,595 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#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;
}
soupesuteaka