D - Problem D. Game HDU - 6312
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. (1≤n≤5001≤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 }
D - Problem D. Game HDU - 6312的更多相关文章
- HDU 6312 - Game - [博弈][杭电2018多校赛2]
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6312 Problem Description Alice and Bob are playing a ...
- HDU - 6312( 2018 Multi-University Training Contest 2)
bryce1010模板 http://acm.hdu.edu.cn/showproblem.php?pid=6312 输出前几项,都是"Yes" #include <bits ...
- HDU 6312.Game-博弈-签到题 (2018 Multi-University Training Contest 2 1004)
2018 Multi-University Training Contest 2 6312.Game 博弈,直接官方题解,懒了. 考虑将游戏变成初始时只有2~n,如果先手必胜的话,那么先手第一步按这样 ...
- hdu 6312
Problem Description Alice and Bob are playing a game.The game is played on a set of positive integer ...
- Problem I. Count - HDU - 6434(欧拉函数)
题意 给一个\(n\),计算 \[\sum_{i=1}^{n}\sum_{j=1}^{i-1}[gcd(i + j, i - j) = 1]\] 题解 令\(a = i - j\) 要求 \[\sum ...
- Problem E. TeaTree - HDU - 6430 (树的启发式合并)
题意 有一棵树,每个节点有一个权值. 任何两个不同的节点都会把他们权值的\(gcd\)告诉他们的\(LCA\)节点.问每个节点被告诉的最大的数. 题解 第一次接触到树的启发式合并. 用一个set维护每 ...
- hdu 4329
problem:http://acm.hdu.edu.cn/showproblem.php?pid=4329 题意:模拟 a. p(r)= R'/i rel(r)=(1||0) R ...
- hdu 1036 (I/O routines, fgets, sscanf, %02d, rounding, atoi, strtol) 分类: hdoj 2015-06-16 19:37 32人阅读 评论(0) 收藏
thanks to http://stackoverflow.com/questions/2144459/using-scanf-to-accept-user-input and http://sta ...
- HDU-5373 The shortest problem
The shortest problem http://acm.hdu.edu.cn/showproblem.php?pid=5373 Time Limit: 3000/1500 MS (Java/O ...
- POJ 3831 & HDU 3264 Open-air shopping malls(几何)
题目链接: POJ:id=3831" target="_blank">http://poj.org/problem?id=3831 HDU:http://acm.h ...
随机推荐
- odoo14使用的文件服务器【NFS】
linux系统之间要文件共享实现方式:目前测试系统为Ubuntu20.04LTS 条件:1.保证两个系统都是linux: 2.目前实现是同一个局域网内: 服务端:172.26.1 ...
- P5749 [IOI2019] 排列鞋子
算是一种新思路吧. 题目要求我们求最少的对调次数,想到了什么?求逆序对个数,我们只需将原来的 \(S_i\) 数组转化一下,求其逆序对个数即可. 转化规则为:从头开始,对于每个还未被赋值的 \(S_i ...
- cosbench工具使用方法
一.Cosbench工具介绍 cosbench是intel开源的针对对象存储开发的测试工具 二.Cosbench安装 运行环境: 这里我们的系统是Centos7.6 依赖软件: JDK nmap-nc ...
- SAP扩展库位
SAP扩充库位有两个方式:1,物料主数据里.2,MMSC. MMSC可以针对物料和工厂批量扩展.一般是业务常用的. FORM locat_dbc USING p_material p_plant p_ ...
- secp256k1算法详解三(点操作关键理论及源码分析)
1 基础概念 1.1 Short Weierstrass Curve 椭圆曲线(Elliptic Curve,EC)是密码学中非常重要的代数结构,在几何上,椭圆曲线是由三次方程描述的一些曲线.不同的公 ...
- vue中的div 拖拽
封装指令 const vDraggable = { mounted(el) { let pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0; el.onmousedown = ...
- css3桃花随意飘落
桃花随意飘落 css3 + js 不实用第三方类库 效果图 <!DOCTYPE html> <html lang="en"> <head> &l ...
- 前端开发系列014-基础篇之Javascript面向对象(三)
一.原型对象相关方法 ❏ in 关键字 ❏ instanceof ❏ hasOwnProperty方法 ❏ constructor构造器属性 ❏ isProtoTypeOf方法 in关键字 作用 用来 ...
- bfs 和 dfs + 回溯 的比较好的写法
简介 刷题经常会使用bfs 和 dfs 总结 问题, 从0,0 走到 n,m 最小花费是多少? 0, 花费2元 1, 花费1元 2, 此路不通 code dfs void dfs(vector< ...
- C++ 字符函数
简介 字符函数可以带来处理的方便性. 参考链接 https://blog.csdn.net/weixin_41162823/article/details/80172379