Skip to content

Commit 97930f2

Browse files
committed
solution of 1st problem in codechef July starters
1 parent 059b4b2 commit 97930f2

File tree

1 file changed

+52
-0
lines changed
  • Codechef/StartersJuly2021

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package StartersJuly2021;
2+
3+
import java.util.Scanner;
4+
5+
public class A {
6+
7+
public static void main(String[] args) {
8+
9+
Scanner sc = new Scanner(System.in);
10+
11+
int t = sc.nextInt();
12+
13+
for (int tt = 0; tt < t; tt++) {
14+
int r1 = sc.nextInt();
15+
int w1 = sc.nextInt();
16+
int c1 = sc.nextInt();
17+
18+
int r2 = sc.nextInt();
19+
int w2 = sc.nextInt();
20+
int c2 = sc.nextInt();
21+
22+
solveTask(r1, w1, c1, r2, w2, c2);
23+
}
24+
sc.close();
25+
}
26+
27+
private static void solveTask(int r1, int w1, int c1, int r2, int w2, int c2) {
28+
29+
int awin = 0, bwin = 0;
30+
31+
if (r1 > r2)
32+
awin++;
33+
else
34+
bwin++;
35+
36+
if (w1 > w2)
37+
awin++;
38+
else
39+
bwin++;
40+
41+
if (c1 > c2)
42+
awin++;
43+
else
44+
bwin++;
45+
46+
if (awin > bwin) {
47+
System.out.println("A");
48+
} else {
49+
System.out.println("B");
50+
}
51+
}
52+
}

0 commit comments

Comments
 (0)