Problem 1604 - Play Apple
Time Limit: 1000MS   Memory Limit: 65536KB    Total Submit: 434  Accepted: 174  Special Judge: No
Description

There are N apples. Two people take turns to either:  1. Divide the apple into two piles with different numbers. 2. The other people selects a pile of apples as the beginning of the next turn. If someone can not meet the requirements, he is lost. Will the first one win the game if both use the best strategy?

Input
There are multiple test cases. The first line of each case contains a integer N. ( 1 <= N <= 1000000000 )
Output
If the first person will win, output “Yes”. Otherwise, output “No”.
Sample Input
2 3 4
Sample Output
No Yes No
题解:题意是把一个数分两半,数字不能相同,一个人不能分就输了;挺好找的规律,一下就找到了,从开始找,两个必败对应必胜;否则必败;
代码:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
const int INF = 0x3f3f3f3f;
typedef long long LL;
int main(){
LL N;
while(~scanf("%lld",&N)){
if(N == || N == ){
puts("No");
}
else if(N == ){
puts("Yes");
}
else{
if((N - ) % == ){
puts("No");
}
else puts("Yes");
}
}
return ;
}

Play Apple(博弈)的更多相关文章

  1. codeforces 812E Sagheer and Apple Tree(思维、nim博弈)

    codeforces 812E Sagheer and Apple Tree 题意 一棵带点权有根树,保证所有叶子节点到根的距离同奇偶. 每次可以选择一个点,把它的点权删除x,它的某个儿子的点权增加x ...

  2. Whu 1604——Play Apple——————【博弈】

    Problem 1604 - Play Apple Time Limit: 1000MS   Memory Limit: 65536KB   Total Submit: 442  Accepted: ...

  3. codeforces 812 E. Sagheer and Apple Tree(树+尼姆博弈)

    题目链接:http://codeforces.com/contest/812/problem/E 题意:有一颗苹果树,这个苹果树所有叶子节点的深度要不全是奇数,要不全是偶数,并且包括根在内的所有节点上 ...

  4. Codeforces 812E Sagheer and Apple Tree ——(阶梯博弈)

    之前在bc上做过一道类似的阶梯博弈的题目,那题是移动到根,这题是移动到叶子.换汤不换药,只要和终态不同奇偶的那些位置做nim即可.因此这题给出了一个条件:所有叶子深度的奇偶性相同.同时需要注意的是,上 ...

  5. Codeforces Round #417 (Div. 2)A B C E 模拟 枚举 二分 阶梯博弈

    A. Sagheer and Crossroads time limit per test 1 second memory limit per test 256 megabytes input sta ...

  6. CodeForces 812E Sagheer and Apple Tree 树上nim

    Sagheer and Apple Tree 题解: 先分析一下, 如果只看叶子层的话. 那么就相当于 经典的石子问题 nim 博弈了. 那我们看非叶子层. 看叶子层的父亲层. 我们可以发现, 如果从 ...

  7. dp --- acdream原创群赛(16) --- B - Apple

    <传送门> B - Apple Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Other ...

  8. iOS: 在iPhone和Apple Watch之间共享数据: App Groups

    我们可以在iPhone和Apple Watch间通过app groups来共享数据.方法如下: 首先要在dev center添加一个新的 app group: 接下来创建一个新的single view ...

  9. hdu----(1849)Rabbit and Grass(简单的尼姆博弈)

    Rabbit and Grass Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

随机推荐

  1. Struts2(四)——页面相关内容

    上篇博客总结了数据流转各个方面的内容,这篇重点说一下框架对于界面上知识. 一,说到页面,记得在总体介绍中,说到Struts2比Struts1的一方面优势就是它支持更多的视图技术(Freemarker, ...

  2. c语言的lua库编写

    gcc编译 gcc -I/usr/local/include/ -L/usr/local/lib/ -lm -o engine_mlisten_lua ./src/engine_mlisten_lua ...

  3. Cocos2d-X中实现菜单特效

    Cocos2d-X中能够讲菜单和动作结合起来使用实现菜单特效 程序实例1:使用菜单和动作的组合实现菜单特效<一> #include "MenuItem.h" CCSce ...

  4. LR实战之Discuz开源论坛——网页细分图结果分析(Web Page Diagnostics)

    续LR实战之Discuz开源论坛项目,之前一直是创建虚拟用户脚本(Virtual User Generator)和场景(Controller),现在,终于到了LoadRunner性能测试结果分析(An ...

  5. Ubuntu配置和修改IP地址

    Ubuntu配置和修改IP地址 1.修改配置文件/etc/network/interfacesroot@ubuntu:~# sudo gedit /etc/network/interfaces 添加以 ...

  6. NPOI新建和读取EXCEL

    //基本NPOI 1.2.5.0 static void Main(string[] args) { string path = string.Format("E:\\export{0}.x ...

  7. css3动画学习的例子来源

    1.这里面有不同的鼠标经过图片效果,图片变大变小,出现文字,向左移动等等 http://dinolatoga.com/demo/webkit-image-hover-effects/ 2.有一篇博客, ...

  8. CSS学习笔记——CSS中定位的浮动float

    昨天在解决了盒模型的问题之后又出现了新的知识模糊点:浮动和绝对定位?今天先解决浮动相关的问题,首先列举出想要解决的问题: 1.浮动到底是怎么样的? 2.浮动对元素的影响有什么? 3.浮动主要用来干什么 ...

  9. mvc 客户端验证

    @model MvcApplication1.Models.ViewClass @{ ViewBag.Title = "View2"; } @******引用这两个js实现客户端的 ...

  10. 关于jquery对象和DOM对象的区别

    这个问题的出现是因为自己对jquery不够了解,只会获取简单的Demo,做简单的操作,将jquery的很多方法和js中的混淆,以为js中的很多方法,在jquery中也可以使用,这是完全错误的理解! 所 ...