# 如何解决C - Little Deer and Blue Cat

0

http://acm.uestc.edu.cn/#/contest/show/51

C - Little Deer and Blue Cat

Time Limit: 3000/1000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others)

In DOTA, there are two Intellegence heroes. One is Enchantress, who is usually called Little Deer by Chinese players. The other is Storm Spirit, who is usually called Blue Cat by Chinese players.

Well, in UESTC-ACM Team, there are two Intellegent team members. One is acerlawson, who is usually called God Liby others. The other is qzy, who is usually called Master Qiu by others.

One day, qzy and acerlawson are arguing with each other about who is the best DOTA player in the team, so they want to play a game. The game is played in DOTA. However, the rule of the game is quite different from DOTA.

In the game, acerlawson plays Little Deer, and qzy plays Blue Cat. They plays the game in turn, andacerlawson goes first. At frist, Little Deer has A HP, and Blue Cat has B HP. In each hero's turn, the hero can choose an integer P and attack the enemy. The enemy will lose P HP. Here P can be 1 or any prime number not greater than the enemy's HP. The one whose HP become 0 first will lose the game.

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

Your task is really simple: Given A and B, find out who will win this game.

Input

The first line is an integer T(1T1000), the number of test cases.

Then T lines follows.

Each line contains two integers A and B(1A,B108).

Output

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

Sample input and output

Sample InputSample Output
3
2 4
4 4
99999989 4
Master Qiu
God Li
Master Qiu

0

1. 如果a,b血量相同，先出手胜。注意每一局先出手顺序是turn的。第一局a先出手，第二句b先出手

2. 如果血量>1，那么寻找小于血量的最大素数，然后血量减去素数，进行下一轮

3. 谁血量先到1，那么必输。

b: 素数3  a=4-3=1

a： 同上 b=1

b:    1     a=1-1=0

b赢了

1. 每一轮计算后，检查血量是否相同，如果相同，参考规则1

2. 求最小素数的函数一定要快！！！！！！！

1. 注意 1<a,b<10^8，而且内存占用65m，所以你可以把所有小于10^8的素数找出来，存到数组里，到时候直接用就好了。（10^8个数大概要400m空间，我不知道素数有多少，如果放不完的话，你就可以舍弃部分小的素数）

S_SONG | 园豆：202 (菜鸟二级) | 2015-03-27 11:32

您需要登录以后才能回答，未注册用户请先注册