Title Description
Taurus team three players in the training apart from his own mouth Hu will be some questions as usual puzzle game. One day cattle Coke came up with a game to play with two other players, rules of the game are as follows:
- A total initial nn card card
- Just get a minimum first step to bring a card, bring it up to n-1 cards.
- Then each step, the two sides at least bring a brand, get the most equal to the number of cards on the card to get the other side of the step.
- Who took the last card will win the game.
You, as a spectator, watching them playing very happy, want to participate in this game, who will take a risk to win.
Enter a description:
The input data includes an integer , indicates the number of a card's initial card.
Output Description:
If you have the upper hand winning strategy, output Bob, otherwise the output Alice.
Entry
2
Export
Alice
Explanation
The upper hand must take a card, then he took the flip another card, the game ends.
answer
- Firstly Truth: but those who is the flip win
- Look at pictures, we consider only just get yourself can win
- , only their own to take a, take a partner, then GG
- , get yourself a, make each other reach 的必败点
- ,如图红色箭头所指两种情况,都是必败状态
- ,拿 个,令对方到达 的必败点
- ,拿 个,令对方到达 的必败点
- ,拿 个,令对方到达 的必败点
- ,无论怎么拿,都会达到对方的必胜点。
- 由此我们可以发现,若当前必败点为 ,距离下一个必败点的距离,就是 位置
- 也就是必败点为:
AC-Code
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ll n; while(cin >> n){
cout << ((n&(-n)) == n ? "Alice" : "Bob") << endl;
}
return 0;
}