959A Mahmoud and Ehab and the even-odd game

A. Mahmoud and Ehab and the even-odd game
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

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

  • 1 ≤an.
  • If it's Mahmoud's turn,ahas to be even, but if it's Ehab's turn,ahas 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?

Input

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

Output

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

Examples
input
Copy
1
output
Ehab
input
Copy
2
output
Mahmoud
Note

In the first sample, Mahmoud can't choose any integerainitially because there is no positive even integer less than or equal to1so Ehab wins.

In the second sample, Mahmoud has to choosea= 2and subtract it fromn. It's Ehab's turn andn= 0. There is no positive odd integer less than or equal to0so Mahmoud wins.



题意:两个人玩游戏,其中Ehab先选择一个数字n,然后另一个人选择一个非负数数字,用n减去这个数。然后轮流,直到有个人不能选择数字。就输了。然后输出赢的那个人的名字。
选择数字的要求:

  • 1 ≤an.
  • If it's Mahmoud's turn,ahas to be even, but if it's Ehab's turn,ahas to be odd.

其中 Mahmoud只能选择偶数,  Ehab一个只能奇数。
题解:模拟 判断数的奇偶性,如果奇数就是Ehab赢,否则另一个赢。

#include
using namespace std;
int main()
{
    int n;
    cin>>n;
    if(n&1)
        puts("Ehab");
    else puts("Mahmoud");
    return 0;
}


你可能感兴趣的:(ACM日常水题练习集)