結果

問題 No.267 トランプソート
ユーザー aaaaaaiuaaaaaaiu
提出日時 2019-08-10 21:29:28
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 715 bytes
コンパイル時間 2,068 ms
コンパイル使用メモリ 203,316 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-26 23:41:45
合計ジャッジ時間 3,463 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:7:22: 警告: ‘n’ is used uninitialized [-Wuninitialized]
    7 |     pair<int,int> c[n];
      |                      ^
main.cpp:6:9: 備考: ‘n’ はここで定義されています
    6 |     int n;
      |         ^

ソースコード

diff #

#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;
}
0