There is a pile of stones with a number of n (n>=2). Both sides of the game take turns to take stones. The rules are as follows:
1) The first mover cannot take all the stones at the first time, at least one stone is taken;
2) The number of stones that can be taken each time after that is at least 1, and at most 2 times the number of stones the opponent just took.
It is agreed that the person who takes the last stone will be the winner.
Conclusion: When n is a Fibonacci number, you must lose.
f[i]:1,2,3,5,8,13,21,34,55,89……
nyoj 385
#include<stdio.h> long long a[110]={0,1}; int main(){ long long n; for(int i=2;i<100;i++){ a[i]=a[i-1]+a[i-2]; } while(scanf("%lld",&n)!=EOF){ int flag=0; for(int i=1;i<100;i++){ if(a[i]==n){ flag=1; break; } } if(flag) printf("No\n"); else printf("Yes\n"); } return 0; }