forked from mpfeifer1/Kattis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkarte.cpp
91 lines (77 loc) · 1.7 KB
/
karte.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int left(vector<bool> v) {
int cards = 13;
for(auto b : v) {
if(b) {
cards--;
}
}
return cards;
}
int main() {
string s;
cin >> s;
vector<bool> p;
vector<bool> k;
vector<bool> h;
vector<bool> t;
p.resize(14, false);
k.resize(14, false);
h.resize(14, false);
t.resize(14, false);
bool duplicate = false;
for(int i = 0; i < s.length(); i+=3) {
char suit = s[i];
int num = 10 * (s[i+1]-'0') + (s[i+2]-'0');
if(suit == 'P') {
if(p[num]) {
duplicate = true;
cout << "GRESKA" << endl;
break;
}
else {
p[num] = true;
}
}
if(suit == 'K') {
if(k[num]) {
duplicate = true;
cout << "GRESKA" << endl;
break;
}
else {
k[num] = true;
}
}
if(suit == 'H') {
if(h[num]) {
duplicate = true;
cout << "GRESKA" << endl;
break;
}
else {
h[num] = true;
}
}
if(suit == 'T') {
if(t[num]) {
duplicate = true;
cout << "GRESKA" << endl;
break;
}
else {
t[num] = true;
}
}
}
if(!duplicate) {
cout << left(p) << " ";
cout << left(k) << " ";
cout << left(h) << " ";
cout << left(t) << " ";
cout << endl;
}
}