CF959A.Mahmoud and Ehab and the even-odd game

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Mahmoud and Ehab play a game called the even-odd game. Ehab chooses his favorite integer n and then they take turns, starting from Mahmoud. In each player's turn, he has to choose an integer a and subtract it from n such that:

  • 1 ≤ a ≤ n.
  • If it's Mahmoud's turn, a has to be even, but if it's Ehab's turn, a has to be odd.

If the current player can't choose any number satisfying the conditions, he loses. Can you determine the winner if they both play optimally?

马哈茂德和埃哈卜玩一个叫做“奇偶游戏”的游戏。埃哈卜选择他最喜爱的整数 nn,然后两人轮流进行操作,马哈茂德先手。在每位玩家的回合中,他必须选择一个整数 aa 并从 nn 中减去它,要求满足:

  • 1≤a≤n1 \leq a \leq n;
  • 若轮到马哈茂德,则 aa 必须为偶数;若轮到埃哈卜,则 aa 必须为奇数。

如果当前玩家无法选择满足上述条件的数,则该玩家输掉游戏。假设双方都以最优策略进行游戏,你能判断出谁将获胜吗?

输入格式

The only line contains an integer n (1 ≤ n ≤ 109), the number at the beginning of the game.

唯一一行包含一个整数 nn(1≤n≤1091 \leq n \leq 10^9),即游戏开始时的数字。

输出格式

Output "Mahmoud" (without quotes) if Mahmoud wins and "Ehab" (without quotes) otherwise.

如果马哈茂德获胜,输出 "Mahmoud"(不带引号);否则输出 "Ehab"(不带引号)。

输入输出样例

  • 输入#1

    1

    输出#1

    Ehab
  • 输入#2

    2

    输出#2

    Mahmoud

说明/提示

In the first sample, Mahmoud can't choose any integer a initially because there is no positive even integer less than or equal to 1 so Ehab wins.

In the second sample, Mahmoud has to choose a = 2 and subtract it from n. It's Ehab's turn and n = 0. There is no positive odd integer less than or equal to 0 so Mahmoud wins.

在第一个样例中,Mahmoud 无法在初始时选择任意整数 aa,因为不存在小于等于 11 的正偶整数,因此 Ehab 获胜。

在第二个样例中,Mahmoud 必须选择 a=2a = 2 并从 nn 中减去它。轮到 Ehab 时,n=0n = 0。不存在小于等于 00 的正奇整数,因此 Mahmoud 获胜。

输入解题思路,AI测评打分。不知道怎么写?

首页