forked from pranavanurag/SPOJSolutions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathARMY.cpp
More file actions
41 lines (36 loc) · 939 Bytes
/
Copy pathARMY.cpp
File metadata and controls
41 lines (36 loc) · 939 Bytes
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
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
int t;
int nMechaGodzilla, nGodzilla;
int MaxMechaGodzilla = 0, MaxGodzilla = 0;
cin>>t;
while(t--&&t>=0)
{
cin>>nGodzilla; //number of monsters in Godzilla's army
cin>>nMechaGodzilla; //number of monsters in MechaGodzilla's army
for(int i=0; i < nGodzilla; i++)
{
int x;
cin>>x; //parsing through Godzilla's army
if(MaxGodzilla < x)
MaxGodzilla = x; //storing strongest monster strength in Godzilla's army
}
for(int i=0; i < nMechaGodzilla; i++)
{
int x;
cin>>x; //parsing through MechaGodzilla's army
if(MaxMechaGodzilla < x)
MaxMechaGodzilla = x; //storing strongest monster strenght in MechaGodzilla's army
}
if(MaxGodzilla >= MaxMechaGodzilla)
cout<<"Godzilla"<<endl;
else if(MaxMechaGodzilla > MaxGodzilla)
cout<<"MechaGodzilla"<<endl;
MaxGodzilla = 0;
MaxMechaGodzilla = 0;
}
return 0;
}