Game

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 184    Accepted Submission(s): 132

Problem Description
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. (1≤n≤500)
 
Output
A line for each test case, 'Yes' or 'No'.
 
Sample Input
1
 
Sample Output
Yes
 
Source
 
Recommend
chendu   |   We have carefully selected several similar problems for you:  6318 6317 6316 6315 6314 
 
题意:给你一串数字,A和B分别可以对这串数字进行操作,每次操作可以删去一个数及他所有的因子,轮到谁时谁无法再进行操作谁就输了
首先考虑1-n,我们可以先不看1,则2-n一定有一个胜者,如果这个状态A胜的话,我们就可以选择那个让我们胜的数,因为1是所有数的因子所以1也会被删去,如果A输,我们可以先去掉1来转变状态。这样A还是会胜。
综述A一定会获胜
 
#include<iostream>
using namespace std;
int main() {
int n;
while( cin >> n ) {
cout << "Yes" << endl;
}
return 0;
}

  

最新文章

  1. innerHTML与innerText的异同
  2. [麦先生]TP3.2之微信开发那点事[基础篇](获取access_token)
  3. leftBarbuttonItem/rightBarButtonItem和leftBarbuttonItems/rightBarButtonItems相关问题
  4. next_permutation 和 一个不成功的案例
  5. C++ Primer : 第九章 : vector变长、string的其他操作以及容器适配器
  6. Spring Richclient — 企业级富客户端开发框架介绍,第 1 部分
  7. SDUST 作业10 Problem I 液晶显示
  8. UIImagePickerController之Block回调
  9. [你必须知道的.NET]第三十回:.NET十年(下)
  10. iOS获取文件和文件夹大小
  11. [Jest] Test JavaScript with Jest
  12. jquery悬停tab2
  13. Cocos2d-x学习笔记(两)Cocos2d-x总体框架
  14. 微信小程序初体验--封装http请求
  15. Educational Codeforces Round 27 补题
  16. awk匹配某一段内容,打印第一段
  17. c#多线程同步之Semaphore
  18. dataTable tab栏切换时错位解决办法
  19. Python使用DDA算法和中点Bresenham算法画直线
  20. thinkphp中setInc、setDec方法

热门文章

  1. Netty服务端启动过程相关源码分析
  2. Linux部署项目遇到问题解决
  3. 5、数组的复制(test2.java、test3.java)
  4. 算法与数据结构基础 - 滑动窗口(Sliding Window)
  5. 搭建Springboot网站有感
  6. vue+element搭建后台管理界面(支持table条件搜索)
  7. Liunx之nginx代理
  8. Oracle delete和truncate实践操作之一
  9. 关于阿里云Mysql分页查询不走索引的问题
  10. (四十一)c#Winform自定义控件-进度条