题意简述

一个数n,Mahmoud珂以取(即如果取\(k\),使\(n = n - k\))一个正偶数,Ehab珂以取一个正奇数,一个人如果不能取了(对于Mahmoud和Ehab \(n = 0\),对于Mahmoud \(n = 1\)),对方就赢了。

Mahmoud先手,问谁会赢。

解法

很简单,如果n是奇数那么Mahmoud一次铁定取不玩,因为奇数减偶数为仍为奇数,所以剩下的肯定是奇数,那么Ehab讲把它取到0必胜;如果n为偶数Mahmoud一次去玩,Ehab必败。

简单来说,就是\(n\)为奇数Ehab胜,否则Mahmoud胜

代码

#include <cstdio>
#define ll long long inline ll read(){
ll x = 0; int zf = 1; char ch = ' ';
while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
if (ch == '-') zf = -1, ch = getchar();
while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar(); return x * zf;
} int main(){
ll n = read();
if (n == 0)
printf("Ehab");
else if(n & 1)
printf("Ehab");
else
printf("Mahmoud");
return 0;
}

[CF959A]Mahmoud and Ehab and the even-odd game题解的更多相关文章

  1. [CF959F]Mahmoud and Ehab and yet another xor task题解

    搞n个线性基,然后每次在上一次的基础上插入读入的数,前缀和线性基,或者说珂持久化线性基. 然后一个num数组记录当时线性基里有多少数 然后每次前缀操作一下就珂以了 代码 #include <cs ...

  2. [CF959D]Mahmoud and Ehab and another array construction task题解

    解法 非常暴力的模拟. 一开始吧\(1 -> 2 \times 10^6\)全部扔进一个set里,如果之前取得数都是与原数组相同的,那么lower_bound一下找到set中大于等于它的数,否则 ...

  3. Codeforces 862A Mahmoud and Ehab and the MEX

    传送门:CF-862A A. Mahmoud and Ehab and the MEX time limit per test 2 seconds memory limit per test 256 ...

  4. Codeforces 959F Mahmoud and Ehab and yet another xor task 线性基 (看题解)

    Mahmoud and Ehab and yet another xor task 存在的元素的方案数都是一样的, 啊, 我好菜啊. 离线之后用线性基取check存不存在,然后计算答案. #inclu ...

  5. E - Mahmoud and Ehab and the bipartiteness CodeForces - 862B (dfs黑白染色)

    Mahmoud and Ehab continue their adventures! As everybody in the evil land knows, Dr. Evil likes bipa ...

  6. Codeforces 862B - Mahmoud and Ehab and the bipartiteness

    862B - Mahmoud and Ehab and the bipartiteness 思路:先染色,然后找一种颜色dfs遍历每一个点求答案. 代码: #include<bits/stdc+ ...

  7. Codeforces 862C - Mahmoud and Ehab and the xor

    862C - Mahmoud and Ehab and the xor 思路:找两对异或后等于(1<<17-1)的数(相当于加起来等于1<<17-1),两个再异或一下就变成0了 ...

  8. Codeforces 862D. Mahmoud and Ehab and the binary string (二分)

    题目链接:Mahmoud and Ehab and the binary string 题意: 一道交互题,首先给出一个字符串的长度l.现在让你进行提问(最多15次),每次提问提出一个字符串,会返回这 ...

  9. CF 959 E. Mahmoud and Ehab and the xor-MST

    E. Mahmoud and Ehab and the xor-MST https://codeforces.com/contest/959/problem/E 分析: 每个点x应该和x ^ lowb ...

随机推荐

  1. template标签就相当于React中的fragment

    template标签就相当于React中的fragment

  2. Linux-档案权限概念

    第一欄代表這個檔案的類型與權限(permission): 這個地方最需要注意了!仔細看的話,你應該可以發現這一欄其實共有十個字元:(圖5.2.1及圖5.2.2內的權限並無關係) 圖5.2.2.檔案的類 ...

  3. Git的资源地址

    下载地址:https://git-scm.com/downloads 安装教程: https://baijiahao.baidu.com/s?id=1619087367741781687&wf ...

  4. 【CTS】几个serialno失败项

    [问题结论] [Common]SN配置项的问题,只可以'数字与大小写字母' 将配置SN改为字母数字组合,测试全部pass [问题描述] CTS三条失败项 run cts -m CtsTelephony ...

  5. Arduino入门之前

    胡乱乱的,就买了,这个 arduino的板子. 哎...本来明明是 学动漫的,然后 不小心就开始 做软件了,然后 越跑越偏...现在 开始 做 硬件开发了... 其实 还有 树莓派 可供选择,算了,不 ...

  6. Yarn 工作机制

    1.工作机制详述 (1)MR程序提交到客户端所在的节点. (2)YarnRunner向ResourceManager申请一个Application. (3)RM将该应用程序的资源路径返回给YarnRu ...

  7. 第二次java面试(用友山东济南分公司)

    坐标:山东潍坊公共实训基地 面试单位:用友济南分公司(来了一位HR和技术经理) 本人状态:距离离校15天 宣讲: 1.女HR和男技术经理来到我们专业提前准备好的教室,先宣传海报和发传单,然后看了4个3 ...

  8. CVE-2016-0822-MTK-drivers/misc/mediatek/connectivity/common/combo/linux/wmt_dev.c#1158

    CVE-2016-0822-MTK-drivers/misc/mediatek/connectivity/common/combo/linux/wmt_dev.c#1158 //mediatek/ke ...

  9. Linux 修改hostname几种方式

    1:  hostname DB-Server          --运行后立即生效(新会话生效),但是在系统重启后会丢失所做的修改 2:  echo DB-Server  > /proc/sys ...

  10. 创建带标签页的MDI WinForms应用程序

    http://www.cnblogs.com/island/archive/2008/12/02/mditab.html 创建MDI应用程序 先创建”Windows窗体应用程序”解决方案Tabable ...