forked from mpfeifer1/Kattis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbela.cpp
61 lines (52 loc) · 949 Bytes
/
bela.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
#include <iostream>
using namespace std;
int getVal(char c) {
switch(c) {
case 'A':
return 11;
case 'K':
return 4;
case 'Q':
return 3;
case 'J':
return 2;
case 'T':
return 10;
}
return 0;
}
int getValTrump(char c) {
switch(c) {
case 'A':
return 11;
case 'K':
return 4;
case 'Q':
return 3;
case 'J':
return 20;
case 'T':
return 10;
case '9':
return 14;
}
return 0;
}
int main() {
int hands;
char trump;
cin >> hands;
cin >> trump;
char num;
char suit;
int sum = 0;
while(cin >> num && cin >> suit) {
if(suit == trump) {
sum += getValTrump(num);
}
else {
sum += getVal(num);
}
}
cout << sum << endl;
}