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 Li by 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, and acerlawson 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(1≤T≤1000), the number of test cases.

Then T lines follows.

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

Output

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

Sample input and output

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

解题报告:

注意到哥德巴赫猜想,任意大于2的偶数必能写成2个素数之和.

so,偶数的情况我们就解决了,那么奇数了?,很显然我们可以得出一个结论:

任意奇数HP的最多三下就GG(扣一点血转换成偶数)

除去素数,那么奇数二下就死如何判断呢?

...do not ask me,i use dp prove that if (x-2) is a prime,he will die in twice

 #include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std; bool IsPrime(int x)
{
if (x <= )
return true;
int k = sqrt(x) + ;
for(int i = ; i <= k ; ++ i)
if ( !(x % i))
return false;
return true;
} int main(int argc,char *argv[])
{
int Case;
scanf("%d",&Case);
while(Case--)
{
int hp1,hp2;
int t1,t2;
scanf("%d%d",&hp1,&hp2);
if ( hp1 % == )
{
if (hp1 == )
t1 = ;
else
t1 = ;
}
else
{
if (IsPrime(hp1))
t1 = ;
else
{
if (IsPrime(hp1-))
t1 = ;
else
t1 = ;
}
} if ( hp2 % == )
{
if (hp2 == )
t2 = ;
else
t2 = ;
}
else
{
if (IsPrime(hp2))
t2 = ;
else
{
if (IsPrime(hp2-))
t2 = ;
else
t2 = ;
}
}
if (t1 >= t2)
printf("God Li\n");
else
printf("Master Qiu\n");
}
return ;
}

UESTC_Little Deer and Blue Cat CDOJ 1025的更多相关文章

  1. [.net 面向对象程序设计进阶] (2) 正则表达式 (一) 快速入门

    [.net 面向对象程序设计进阶] (2) 正则表达式 (一) 快速入门 1. 什么是正则表达式? 1.1 正则表达式概念 正则表达式,又称正则表示法,英文名:Regular Expression(简 ...

  2. VennDiagram 画文氏图/维恩图/Venn

    install.packages("VennDiagram")library(VennDiagram) A = 1:150B = c(121:170,300:320)C = c(2 ...

  3. Linux下为何都是文件的理解

    所谓“文件”,就是在我们的电脑中,以实现某种功能.或某个软件的部分功能为目的而定义的一个单位. Linux都是以文件的形式存在,当我们访问某个文件(Linux中的文件有目录,连接,普通文本),由于Li ...

  4. Java-UrlRewrite中文api文档

    安装 1. 下载jar包, 并加入到WEB-INF/lib下 2. 在WEB-INF/web.xml中增加下面的配置 <filter> <filter-name>UrlRewr ...

  5. JS中创建自定义对象的方法

    1.直接给对象扩充属性和方法: 2.对象字面量: 3.工厂方式: 4.构造函数方式: 5.原型方式: 6.混合方式. <script> // 1.直接给对象扩充属性和方法; var cat ...

  6. python学习笔记(6)

    第6章 组合数据类型 组合类型的三种表达形式:集合.序列.字典 集合类型及操作 定义:集合是多个元素的无序组合 集合类型与数学中的集合概念一致 集合元素之间无序,每个元素唯一,不存在相同元素 集合元素 ...

  7. php7 教程

    标量类型声明 1. 分为强制模式和严格模式 2. 这些类型的函数参数可以执行声明 int, float, bool, string, interfaces, array, callable 例如: f ...

  8. 70个注意的Python小Notes

    Python读书笔记:70个注意的小Notes 作者:白宁超 2018年7月9日10:58:18 摘要:在阅读python相关书籍中,对其进行简单的笔记纪要.旨在注意一些细节问题,在今后项目中灵活运用 ...

  9. 用R画韦恩图

    #导入R包 library(grid)library(futile.logger)library(VennDiagram) #建立测试数据集 A = 1:150B = c(121:170,300:32 ...

随机推荐

  1. 40个UI设计工具

    摘要:用户界面设计在持续的基础上不断成长和演变.要跟上时代,你需要关注趋势.新资源和正被实施和谈论的新技术. 导读:用户界面设计在持续的基础上不断成长和演变.要跟上时代,你需要关注趋势.新资源和正被实 ...

  2. HDU1841——KMP算法

    这个题..需要对KMP的模板理解的比较透彻,以前我也只是会套模板..后来才知道..之会套模板是不行的..如果不能把握模板的每一个细节`,至少能搞清楚模板的每一个模块大体是什么意思.. 题意是给出两个串 ...

  3. 第13讲- Android之消息提示Notification

    第13讲 Android之消息提示Notification .Notification Notification可以理解为通知的意思一般用来显示广播信息,通知可以显示到系统的上方的状态栏(status ...

  4. CREATE PROCEDURE

    1 CREATE PROCEDURE(创建) CREATE PROCEDURE存储过程名(參数列表) BEGIN SQL语句代码块 END 注意: 由括号包围的參数列必须总是存在.假设没有參数,也该使 ...

  5. [Hapi.js] Serving static files

    hapi does not support serving static files out of the box. Instead it relies on a module called Iner ...

  6. Unity 定时开启/关闭外部应用

    自从加入工作的队伍里,博客都荒废了,今天周末,难得清静,写篇博客!刚才看到了Process类,随手写了个小demo.给大家分享下! 首先大家要对Process类有一些简单的了解,参考资料:https: ...

  7. Linux远程登录

    Linux远程登录 远程登录 关闭linux的防火墙 /etc/init.d/iptables stop 启动VNC服务器 Vncserver & 然后记住desktop is localho ...

  8. Mob短信验证的配置的解释

    原文地址:http://www.jb51.net/article/84946.htm 关于mob短信验证的解释: mob官方是这样写的: repositories{ flatDir{ dirs 'li ...

  9. Xcode 常用快捷键及代码自动排版 二

    Xcode常用快捷键,网上找的总结一下,特别是格式化代码 隐藏xcode command+h退出xcode command+q关闭窗口 command+w关闭所有窗口 command+option+w ...

  10. 网络编程之UDP

    UDP编程流程:一服务端:1.创建socket.  DatagramSocket socket = new DatagramSocket(8878); 2.创建数据包,用来接收发送的数据包.byte[ ...