zcmu-1916 E.当然是选择原谅你(找规律博弈)

 

Description

        最近HX无所事事,他的脑海里出现了一个想法。这个游戏盘的大小是n*m。首先,硬币放在右上角(1,m)。 每次有人可以将硬币移动到左边,下面或左下方的空白处。不能移动的人将失去游戏。 HX只能无聊到找XH玩了。游戏总是从HX开始。 如果两人都玩得很好,谁能赢得比赛呢?

Input

多组输入,直到输入0 0结束。

输入n和m(1 ≤ n ≤ 10^6)表示游戏盘的长与宽。

Output

如果HX赢则输出H,否则输出X。

Sample Input

5 3 5 4 0 0

Sample Output

X H

#include<cstdio>
#include <cstring>
#include<algorithm>
#include <iostream>
#include <cmath>
//#include <stdio.h>
#define ll long long
using namespace std;

int main()
{
    int n,m;
    while(~scanf("%d%d",&n,&m))
    {
        if(!n&&!m) break;
        if(n%2==0||m%2==0)
            printf("H\n");
        else
            printf("X\n");
    }
    return 0;
}

猜你喜欢

转载自blog.csdn.net/hzyhfxt/article/details/82217236
今日推荐