結果
問題 | No.267 トランプソート |
ユーザー |
|
提出日時 | 2019-08-10 22:24:46 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 768 bytes |
コンパイル時間 | 2,110 ms |
コンパイル使用メモリ | 198,184 KB |
最終ジャッジ日時 | 2025-01-07 11:40:19 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n; cin>>n; pair<int,int> c[n]; int a[256]; a[1]='A'; a[2]='D'; a[3]='C'; a[4]='H'; a[5]='S'; a[10]='T'; a[11]='J'; a[12]='Q'; a[13]='K'; a['A']=1; a['D']=2; a['C']=3; a['H']=4; a['S']=5; a['T']=10; a['J']=11; a['Q']=12; a['K']=13; for (int i=0;i<n;i++) { string s;cin>>s; int suit=a[s[0]]; int num=isdigit(s[1])?s[1]-'0':a[s[1]]; c[i]={suit,num}; } sort(c,c+n); for (auto p:c) { char suit=a[p.first]; char num=(2<=p.second&&p.second<=9)?p.second+'0':a[p.second]; cout<<suit<<num<<' '; } cout<<endl; return 0; }