HDU - 2018 Multi-University Training Contest 2 - 1004: Game

简介: HDU - 2018 Multi-University Training Contest 2 - 1004: Game

Game

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)

Total Submission(s): 0    Accepted Submission(s): 0


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


题目大意:A / B两人游戏,A先开始,每次在 1~n 中取一个数 i,消除 i 的因子(包括 1 和它自己本身),谁先消除完谁胜利。输入 n,问 A 可以胜利吗?


解题思路:因为一个状态不是必胜态就是必败态。输入 n,如果除 1 以外的(2~n)对 A 来说,如果是必胜态,那么 A 赢了;如果是必败态,那么 A 先把 1 取了,结果就反败为胜。又因为 A 先取,所以先手必赢。


AC 代码



/

#include<bits/stdc++.h>
#include<cmath>
#define mem(a,b) memset(a,b,sizeof a);
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        puts("Yes");
    }
    return 0;
}
目录
相关文章
|
Java
HDU - 2018 Multi-University Training Contest 3 - 1012: Visual Cube
HDU - 2018 Multi-University Training Contest 3 - 1012: Visual Cube
130 0
HDU - 2018 Multi-University Training Contest 3 - 1012: Visual Cube
|
Java
HDU - 2018 Multi-University Training Contest 2 - 1010: Swaps and Inversions
HDU - 2018 Multi-University Training Contest 2 - 1010: Swaps and Inversions
108 0
|
Java
HDU - 2018 Multi-University Training Contest 1 - 1001: Maximum Multiple
HDU - 2018 Multi-University Training Contest 1 - 1001: Maximum Multiple
97 0
|
Java
2017 Multi-University Training Contest - Team 9 1003&&HDU 6163 CSGO【计算几何】
CSGO Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 127    Accepted Submission(s): 20 Pro...
1411 0
|
Java
2017 Multi-University Training Contest - Team 9 1005&&HDU 6165 FFF at Valentine【强联通缩点+拓扑排序】
FFF at Valentine Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1060    Accepted Submission(...
1208 0
|
Java
2017 Multi-University Training Contest - Team 9 1002&&HDU 6162 Ch’s gift【树链部分+线段树】
Ch’s gift Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1354    Accepted Submission(s): 496 Problem Description Mr.
1298 0
2017 Multi-University Training Contest - Team 9 1004&&HDU 6164 Dying Light【数学+模拟】
Dying Light Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 513    Accepted Submission(s): ...
1180 0
2017 Multi-University Training Contest - Team 1 1003&&HDU 6035 Colorful Tree【树形dp】
Colorful Tree Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 1539    Accepted Submission(s...
1335 0