A11737 | Mahmoud and Ehab and the even-odd game
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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?
- $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?
输入格式
The only line contains an integer $n$ $(1<=n<=10^{9})$ , the number at the beginning of the game.
输出格式
Output "Mahmoud" (without quotes) if Mahmoud wins and "Ehab" (without quotes) otherwise.
输入输出样例
输入 #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.
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.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted