結果
| 問題 |
No.267 トランプソート
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-08-10 21:29:28 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 715 bytes |
| コンパイル時間 | 2,295 ms |
| コンパイル使用メモリ | 197,368 KB |
| 最終ジャッジ日時 | 2025-01-07 11:40:08 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:22: warning: ‘n’ is used uninitialized [-Wuninitialized]
7 | pair<int,int> c[n];
| ^
main.cpp:6:9: note: ‘n’ was declared here
6 | int n;
| ^
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int 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 num=isdigit(s[1])?s[1]-'0':a[s[1]];
int suit=a[s[1]];
c[i]={num,suit};
}
sort(c,c+n);
for (auto p:c) {
cout<<(char)a[p.second]<<(2<=p.first&&p.first<=9?p.first:(char)a[p.first])<<' ';
}
cout<<endl;
return 0;
}