题意简述

一个数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. javaScript 递归 闭包 私有变量

    递归 递归的概念 在程序中函数直接或者间接调用自己. 跳出结构,有了跳出才有结果. 递归的思想 递归的调用,最终还是要转换为自己这个函数.    应用 function sum(n){ if(n == ...

  2. clinical-逻辑核查数据的操作

    1. 前端页面样式 2. 前端代码 添加: 展示: 修改 删除 3. 后台代码 封装的DAO类数据 # coding: utf-8 from pdform.services.db.dbCore imp ...

  3. Linux命令整理 - 通用版

    通用版 - 系统架构 /dev 设备文件夹 null 有去无回 mouse /sbin 系统管理必备程序 cfdisk.dhcpcd.dump.e2fsck.fdisk.halt.ifconfig.i ...

  4. python+selenium文本框对象以及按钮对象操作

    文本框对象 from selenium import webdriverfrom time import sleep driver = webdriver.Firefox() # 指定和打开浏览器ur ...

  5. CDH平台搭建遇到的问题

    安装之前遇到的问题:   Note: Forwarding request to 'systemctl disable NetworkManager.service'. Removed symlink ...

  6. Java相关面试题总结+答案(八)

    [RabbitMQ] 135. RabbitMQ 的使用场景有哪些? 抢购活动,削峰填谷,防止系统崩塌. 延迟信息处理,比如 10 分钟之后给下单未付款的用户发送邮件提醒. 解耦系统,对于新增的功能可 ...

  7. Java日志使用slf4j 配置log4j后,有日志文件 但日志文件内容为空

    SLF4J的全称是Simple Logging Facade for Java,即简单日志门面. SLF4J并不是具体的日志框架,而是作为一个简单门面服务于各类日志框架,如java.util.logg ...

  8. [Web 前端] 014 css 盒子模型

    1. 简介 元素在页面中显示成一个方块,类似一个盒子 把元素叫做盒子,设置对应的样式分别为 盒子的边框(border) 盒子内的内容和边框之间的间距(padding) 盒子与盒子之间的间距(margi ...

  9. [Python3 填坑] 011 元组中有多个最值,索引出来的是哪一个

    目录 1. print( 坑的信息 ) 2. 开始填坑 (1) max() (2) min() (3) 结论 1. print( 坑的信息 ) 挖坑时间:2019/01/11 明细 坑的编码 内容 P ...

  10. js获取指定字符后面的字符

    function getCaption(obj){ var index=obj.lastIndexOf("\-"); obj=obj.substring(index+1,obj.l ...