Search This Blog

Thursday, 18 August 2016

SPOJ- Army Strength Problem Solution

SPOJ- Army Strength Problem Solution #ad-hoc problem

Solution:-

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int tc;
    string ex;
    cin>>tc;
    getline(cin,ex);
    while(tc--)
    {
        int NG,NM,num;
        int max_NG=-1,max_NM=-1;

        cin>>NG>>NM;

        for(int i=0;i<NG;i++)
        {
            cin>>num;
            max_NG=max_NG>num?max_NG:num;
        }

        for(int i=0;i<NM;i++)
        {
            cin>>num;
            max_NM=max_NM>num?max_NM:num;
        }

        if(max_NM<=max_NG)
            cout<<"Godzilla\n";
        else
            cout<<"MechaGodzilla\n";
        getline(cin,ex);
    }
    return 0;

}

1 comment:

  1. ▷Casino Site 2021 | ₹10,000 Free Spins for €500 + 150
    and win on Luckyclub online casino with bonus for you. Play all the top Slots, Jackpots, Live Dealer, Sports betting and so much more at 카지노사이트luckclub

    ReplyDelete