#include <iostream> using namespace std; | |
bool card[4][14]; | |
//S, D, H, C | |
void init(){ | |
for(int i=0; i<4; i++){ | |
for(int j=0; j<14; j++){ | |
card[i][j]=0; | |
} | |
} | |
} | |
int main(){ | |
int T; | |
cin >> T; | |
for(int tc=1; tc<=T; tc++){ | |
init(); | |
int S=13; | |
int D=13; | |
int H=13; | |
int C=13; | |
bool chk=0; | |
string s; | |
cin >> s; | |
for(int i=0; i<s.size(); i+=3){ | |
int alpha=0; | |
if(s[i]=='S') S--; | |
else if(s[i]=='D') { | |
D--; | |
alpha=1; | |
} | |
else if(s[i]=='H') { | |
H--; | |
alpha=2; | |
} | |
else if(s[i]=='C') { | |
C--; | |
alpha=3; | |
} | |
int tmp=(10*(s[i+1]-'0')+(s[i+2]-'0')); | |
if(!card[alpha][tmp]){ | |
card[alpha][tmp]=1; | |
} | |
else { | |
chk=1; | |
break; | |
} | |
} | |
if(chk) cout <<"#"<<tc <<" ERROR"<<endl; | |
else cout <<"#"<<tc <<" "<<S <<" " << D <<" " <<H <<" "<<C<<endl; | |
} | |
} |
'알고리즘 문제 풀이 > 1DP_과제(~180615)' 카테고리의 다른 글
180411_세가지 합 구하기 (0) | 2018.04.11 |
---|---|
180410_2161_카드1 (0) | 2018.04.10 |
180408_3190_뱀 (0) | 2018.04.08 |
180407_14503_로봇청소기 (0) | 2018.04.07 |
180407_13460_째로탈출 2 (0) | 2018.04.07 |