Uestc_little Deer and Blue Cat cdoj 1025

Source: Internet
Author: User
Tags dota

DOTAin, there is intellegence heroes. One Enchantress is usually called by Little Deer Chinese players. Storm Spiritthe other are, who are usually called by Blue Cat Chinese players.

Well, in UESTC-ACM team, there is, and Intellegent team members. One acerlawson is usually called by God Li others. qzythe other are, who are usually called by Master Qiu others.

One day, and was qzy acerlawson arguing with each of the WHO's the best DOTA player on the team, so they want to PLA Y a game. The game is played in DOTA . However, the rule of the game is quite different from DOTA .

In the game,acerlawsonPlaysLittle Deer, andqzyPlaysBlue Cat. They plays the game in turn, andacerlawsonGoes first. At Frist,Little DeerHasAHP, andBlue CatHasBHp. In each hero ' s turn, the hero can choose an integerPand attack the enemy. The enemy would losePHP. Herep  can be < Span id= "mathjax-span-1234" class= "math" >1  or any prime number not greater than the enemy ' s HP. The one whose HP become < Span id= "mathjax-span-1237" class= "math" >0  first'll lose the game.

As they is both intellegent, they'll make the best choice to win this game. In another word, they'll try to kill the other as early as possible.

Your task is really simple:given A and B, the find out who'll win this game.

Input

The first line was an integer t(1≤T≤) , the number of test cases.

Then T lines follows.

Each line contains integersa  and < Span class= "Mathjax_preview" >b (1 ≤a,b≤10 8) .

Output

For each test case, print God Li if Acerlawson would win the game. Otherwise print Master Qiu .

Sample Input and output
Sample Input Sample Output
32 44 499999989 4
Master Qiugod Limaster Qiu

Problem Solving Report:

Notice Goldbach conjecture that an even number greater than 2 can be written as the sum of 2 primes.

So, even if we solve the situation, then the odd number? , it is clear that we can draw a conclusion:

Any odd number of HP of up to three down on GG (Buckle a little blood into even)

Remove the prime number, then the odd two dead how to judge it?

... does not ask Me,i the use DP prove the IF (x-2) is a prime,he would die in twice

1#include <iostream>2#include <cstring>3#include <cstdio>4#include <algorithm>5#include <cmath>6 using namespacestd;7 8 BOOLIsPrime (intx)9 {Ten   if(x <=2) One    return true; A   intK = sqrt (x) +1; -    for(inti =2; I <= K; ++i) -    if( ! (x%i)) the     return false; -   return true; - } -  + intMainintargcChar*argv[]) - { +   intCase ; Ascanf"%d",&Case ); at    while(case--) -    { -          intHp1,hp2; -          intt1,t2; -scanf"%d%d",&hp1,&HP2); -          if(Hp1%2==0) in           { -                 if(HP1 = =2) toT1 =1; +                 Else -T1 =2; the        } *       Else $        {Panax Notoginseng              if(IsPrime (HP1)) -T1 =1; the              Else +               { A                     if(IsPrime (hp1-2)) theT1 =2; +                     Else -T1 =3; $            } $        } -        -        the       if(Hp2%2==0) -           {Wuyi                 if(HP2 = =2) thet2 =1; -                 Else Wut2 =2; -        } About       Else $        { -              if(IsPrime (HP2)) -t2 =1; -              Else A               { +                     if(IsPrime (hp2-2)) thet2 =2; -                     Else $t2 =3; the            } the        } the       if(T1 >=T2) theprintf"God li\n"); -       Else inprintf"Master qiu\n"); the    } the   return 0; About}

Uestc_little Deer and Blue Cat cdoj 1025

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.