結果
問題 | No.267 トランプソート |
ユーザー |
![]() |
提出日時 | 2015-08-21 22:49:15 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 1,816 bytes |
コンパイル時間 | 744 ms |
コンパイル使用メモリ | 91,084 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-18 11:48:40 |
合計ジャッジ時間 | 1,387 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:51:30: warning: ‘temp’ may be used uninitialized in this function [-Wmaybe-uninitialized] 51 | temp += c2 -'0'; | ~~~~~^~~~~~~~~~
ソースコード
#define _USE_MATH_DEFINES#include <iostream>#include <iomanip>#include <sstream>#include <algorithm>#include <cmath>#include <string>//#include <array>#include <list>#include <queue>#include <vector>#include <complex>#include <set>#include <map>/////////#define REP(i, x, n) for(int i = x; i < n; i++)#define rep(i,n) REP(i,0,n)#define P(p) cout<<(p)<<endl;#define PII pair<int,int>/////////typedef long long LL;typedef long double LD;/////////using namespace::std;/////////int main(void){std::cin.tie(0);std::ios::sync_with_stdio(false);std::cout << std::fixed;////cout << setprecision(16);//int N;cin>>N;char c1,c2;vector<int> v;v.resize(N);int temp;rep(i,N){cin>>c1>>c2;if(c1 == 'D'){temp = 100;}else if(c1 == 'C'){temp = 200;}else if(c1 == 'H'){temp = 300;}else if(c1 == 'S'){temp = 400;}if( '2' <= c2 && c2 <= '9'){temp += c2 -'0';}else if( c2 == 'A'){temp += 1;}else if( c2 == 'T'){temp+=10;}else if( c2 == 'J'){temp+=11;}else if( c2 == 'Q'){temp+=12;}else if( c2 == 'K'){temp+=13;}v[i] = temp;}sort(v.begin(),v.end() );vector<int>::iterator it = v.begin();while( it != v.end() ){switch(*it/100){case 1:cout<<'D';break;case 2:cout<<'C';break;case 3:cout<<'H';break;case 4:cout<<'S';break;}switch(*it%100){case 1:cout<<'A';break;case 2:cout<<'2';break;case 3:cout<<'3';break;case 4:cout<<'4';break;case 5:cout<<'5';break;case 6:cout<<'6';break;case 7:cout<<'7';break;case 8:cout<<'8';break;case 9:cout<<'9';break;case 10:cout<<'T';break;case 11:cout<<'J';break;case 12:cout<<'Q';break;case 13:cout<<'K';break;}if((it+1) != v.end() ){cout << " ";}else{cout << endl;}++it;}return 0;}