#include <iostream>
using namespace std;
int suit(char c) {
if (c == 'P') return 0;
if (c == 'K') return 1;
if (c == 'H') return 2;
return 3;
}
int num(string s) {
int ret = 0;
for (char z : s) {
ret *= 10; ret += (z-'0');
}
return ret;
}
bool vis[4][13];
int ans[4];
int main() {
string s; cin >> s;
int n = s.length();
for (int i = 0; i < n; i += 3) {
int st = suit(s[i]);
int m = num(s.substr(i+1,2));
m--;
if (vis[st][m]) {
cout << "GRESKA" << endl;
return 0;
}
vis[st][m] = true;
}
for (int i = 0; i < 4; i++) {
ans[i] = 13;
for (int j = 0; j < 13; j++) {
ans[i] -= vis[i][j];
}
}
for (int i = 0; i < 4; i++) {
cout << ans[i] << " ";
}
cout << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
300 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |