-
Notifications
You must be signed in to change notification settings - Fork 1
/
WINNERR.java
48 lines (38 loc) · 1023 Bytes
/
WINNERR.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
package codechef;
import java.util.ArrayList;
import java.util.Scanner;
public class WINNERR {
public static void main(String[] args) {
ArrayList<Integer> pa = new ArrayList<>();
ArrayList<Integer> pb = new ArrayList<>();
ArrayList<Integer> qa = new ArrayList<>();
ArrayList<Integer> qb = new ArrayList<>();
Scanner sc = new Scanner(System.in);
int cases = sc.nextInt();
sc.nextLine();
for (int i = 0; i < cases; i++) {
String[] split_in = sc.nextLine().split(" ");
pa.add(Integer.parseInt(split_in[0]));
pb.add(Integer.parseInt(split_in[1]));
qa.add(Integer.parseInt(split_in[2]));
qb.add(Integer.parseInt(split_in[3]));
}
sc.close();
for(int i=0;i<cases;i++) {
System.out.println(getBestRank(pa.get(i), pb.get(i), qa.get(i), qb.get(i)));
}
}
public static String getBestRank(int pa,int pb,int qa,int qb) {
int x=Math.max(pa, pb);
int y=Math.max(qa, qb);
if(x<y) {
return "P";
}
else if(x>y) {
return "Q";
}
else {
return "Tie";
}
}
}