-
Notifications
You must be signed in to change notification settings - Fork 0
/
ArmyStrength.java
48 lines (40 loc) · 896 Bytes
/
ArmyStrength.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
import java.util.Scanner;
public class ArmyStrength{
public static void main(String[] args){
Scanner ob = new Scanner(System.in);
int num_cases = ob.nextInt();
for(int i = 0 ; i<num_cases ; i++){
int n = ob.nextInt();
int m = ob.nextInt();
int[] arr1 = new int[n];
int[] arr2= new int[m];
for(int j = 0 ; j<n ; j++){
arr1[j] = ob.nextInt();
}
for(int j = 0; j<m ; j++){
arr2[j] = ob.nextInt();
}
int high1 = arr1[0];
int high2 = arr2[0];
for(int j=1 ; j<n ; j++){
if(arr1[j]>high1){
high1 = arr1[j];
}
}
for(int j=1; j<m; j++){
if(arr2[j]>high2){
high2 = arr2[j];
}
}
if(high1 >= high2){
System.out.println("Godzilla");
}
else if(high1<high2){
System.out.println("MechaGodzilla");
}
else{
System.out.println("uncertain");
}
}
}
}