zoukankan      html  css  js  c++  java
  • D

    Alice and Bob are playing a game. 
    The game is played on a set of positive integers from 1 to n. 
    In one step, the player can choose a positive integer from the set, and erase all of its divisors from the set. If a divisor doesn't exist it will be ignored. 
    Alice and Bob choose in turn, the one who cannot choose (current set is empty) loses. 
    Alice goes first, she wanna know whether she can win. Please judge by outputing 'Yes' or 'No'.

    Input

    There might be multiple test cases, no more than 10. You need to read till the end of input. 
    For each test case, a line containing an integer n. (1n5001≤n≤500) 
    Output

    A line for each test case, 'Yes' or 'No'. 
    Sample Input

    1

    Sample Output

    Yes

    简单分析
    1)一定会由某一方赢,不存在平局。
    2)在第一步不取1的情况下 第一条成立
    3)先手可以取1
    =>所以对于任意一种情况,
      若先手不取1必输,则先手取1必赢;
      若先手取1必输,则先手不取1必赢;
    =>先手必赢
    1 #include <bits/stdc++.h>
    2 using namespace std;
    3 int main(){
    4     int t;
    5     while(cin>>t)
    6         cout<<"Yes"<<endl;
    7 }

    作者:YukiRinLL

    出处:YukiRinLL的博客--https://www.cnblogs.com/SutsuharaYuki/

    您的支持是对博主最大的鼓励,感谢您的认真阅读。

    本文版权归作者所有,欢迎转载,但请保留该声明。

  • 相关阅读:
    jquery两个滚动条样式
    js双层动画幻灯
    漂浮QQ
    js物理弹性窗口
    js抽奖跑马灯程序
    经典算法
    判断手机浏览器终端设备
    javascript判断手机旋转横屏竖屏
    【转】处理百万级以上的数据提高查询速度的方法
    Linux -- Centos 下配置LNAMP 服务器环境
  • 原文地址:https://www.cnblogs.com/SutsuharaYuki/p/11224337.html
Copyright © 2011-2022 走看看