-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bela.java
48 lines (46 loc) · 1.25 KB
/
Bela.java
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
/*
* Problem: https://open.kattis.com/problems/bela
*
* @author Bivash Pandey
*/
import java.util.Scanner;
public class Bela {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
char c = input.next().charAt(0);
int sum = 0;
for(int i=0; i<4*n; i++) {
String str = input.next();
if(str.charAt(1) == c) {
if(str.charAt(0) == 'J') {
sum += 20;
}
else if(Character.getNumericValue(str.charAt(0)) == 9){
sum += 14;
}
}
else {
if(str.charAt(0) == 'J') {
sum += 2;
}
else if(Character.getNumericValue(str.charAt(0)) == 9) {
sum += 0;
}
}
if(str.charAt(0) == 'A') {
sum += 11;
}
else if(str.charAt(0) == 'K') {
sum += 4;
}
else if(str.charAt(0) == 'Q') {
sum += 3;
}
else if(str.charAt(0)=='T') {
sum += 10;
}
}
System.out.println(sum);
}
}