結果

問題 No.267 トランプソート
ユーザー matsukin1111
提出日時 2019-04-14 21:53:28
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,812 bytes
コンパイル時間 1,096 ms
コンパイル使用メモリ 102,520 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-19 16:57:50
合計ジャッジ時間 2,034 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int check(char)':
main.cpp:51:1: warning: control reaches end of non-void function [-Wreturn-type]
   51 | }
      | ^
main.cpp: In function 'std::string conv(int)':
main.cpp:67:1: warning: control reaches end of non-void function [-Wreturn-type]
   67 | }
      | ^

ソースコード

diff #
プレゼンテーションモードにする

#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility>
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(int i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(int i = m;i >= n;--i)
#define INF INT_MAX/2
using namespace std;
using ll = long long;
using R = double;
using Data = pair<ll, vector<int>>;
const ll MOD = 1e9 + 7;
const ll inf = 1LL << 50;
struct edge { ll from; ll to; ll cost; };
int check(char c) {
if (2 <= c - '0' && c - '0' <= 9)return c - '0';
switch (c) {
case 'A':
return 1;
case 'T':
return 10;
case 'J':
return 11;
case 'Q':
return 12;
case 'K':
return 13;
}
}
string conv(int i) {
if (2 <= i && i <= 9)return to_string(i);
switch (i) {
case 1 :
return "A";
case 10:
return "T";
case 11 :
return "J";
case 12 :
return "Q";
case 13:
return "K";
}
}
int main() {
int n;
cin >> n;
vector<int>D;
vector<int>C;
vector<int>H;
vector<int>S;
rep(i, 0, n) {
string s;
cin >> s;
char temp = s[0];
int num = check(s[1]);
switch (temp) {
case 'D':
D.pb(num);
break;
case 'C':
C.pb(num);
break;
case 'H':
H.pb(num);
break;
case 'S':
S.pb(num);
break;
}
}
sort(all(D));
sort(all(C));
sort(all(H));
sort(all(S));
fore(i, D) {
cout << 'D' << conv(i) << " ";
}
fore(i, C) {
cout << 'C' << conv(i) << " ";
}
fore(i, H) {
cout << 'H' << conv(i) << " ";
}
fore(i, S) {
cout << 'S' << conv(i) << " ";
}
cout << endl;
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0