-
Notifications
You must be signed in to change notification settings - Fork 0
/
Equinox.java
37 lines (33 loc) · 838 Bytes
/
Equinox.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
import java.util.*;
class Equinox {
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
int t = kb.nextInt();
while(t>0){
t--;
int n = kb.nextInt();
long a = kb.nextInt();
long b = kb.nextInt();
String arr[] = new String[n];
for(int i=0; i<n; i++)
arr[i] = kb.next();
long x = 0;
long y = 0;
String str = "EQUINOX";
for(int i=0; i<n; i++){
char ch = arr[i].charAt(0);
String c = String.valueOf(ch);
if(str.contains(c))
x+=a;
else
y+=b;
}
if(x>y)
System.out.println("SARTHAK");
else if(y>x)
System.out.println("ANURADHA");
else
System.out.println("DRAW");
}
}
}