結果

問題 No.267 トランプソート
ユーザー CleyLCleyL
提出日時 2020-02-01 03:17:23
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 906 bytes
コンパイル時間 913 ms
コンパイル使用メモリ 78,324 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-18 22:52:03
合計ジャッジ時間 1,840 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 1 ms
4,348 KB
testcase_21 AC 1 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'bool comp(const std::string&, std::string&)':
main.cpp:24:1: warning: control reaches end of non-void function [-Wreturn-type]
   24 | }
      | ^

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
char C1[4] = {'D','C','H','S'};
char C2[13] = {'A','2','3','4','5','6','7','8','9','T','J','Q','K'};
bool comp(const string&a,string&b){
    for(int i = 0; 4 > i; i++){
        if(C1[i] == a[0] && C1[i] == b[0]){
            for(int j = 0; 13 > j; j++){
                if(C2[j] == a[1]){
                    return 1;
                }else if(C2[j] == b[1]){
                    return 0;
                }
            }
        }else if(C1[i] == a[0]){
            return 1;
        }else if(C1[i] == b[0]){
            return 0;
        }
    }
}
int main(){
    int n;cin>>n;
    vector<string> s(n);
    for(int i = 0; n > i; i++){
        cin>>s[i];
    }
    sort(s.begin(),s.end(),comp);
    for(int i = 0; n > i; i++){
        cout << s[i];
        if(i+1 != n)cout << " ";
    }
    cout << endl;
}
0