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
2018 Multi-University Training Contest 2
打了個前20的表,發現都是Yes
大膽交了一發,直接過了(人有多大膽,地有多大產)
#include<bits/stdc++.h>
#define mp make_pair
#define fir first
#define se second
#define ll long long
#define pb push_back
using namespace std;
const int maxn=5e5+10;
const ll mod=1e9+7;
const int maxm=1e6+10;
const double eps=1e-7;
const ll inf=(ll)1e13;
int ans=0;
int n;
void dfs(set<int> s,int ord){
if (ans==1) return ;
if (s.size()==0){
if (ord==1){
ans=1;
return ;
}
}
for (int i=1;i<=n;i++){
if (ans==1) return ;
if (!s.count(i)) continue;
set<int> temp=s;
temp.erase(i);
for (int j=1;j<=i/2;j++){
if (i%j==0){
temp.erase(j);
}
}
dfs(temp,ord^1);
}
}
int main(){
while (~scanf("%d",&n)){
printf("Yes\n");
}
return 0;
}