首页 > 其他 > 详细

Gym - 100952G

时间:2017-07-17 21:00:19      阅读:227      评论:0      收藏:0      [点我收藏+]

G. The jar of divisors

 

Alice and Bob play the following game. They choose a number N to play with. The rules are as follows:

- They write each number from 1 to N on a paper and put all these papers in a jar.

- Alice plays first, and the two players alternate.

- In his/her turn, a player can select any available number M and remove its divisors including M.

- The person who cannot make a move in his/her turn wins the game.

Assuming both players play optimally, you are asked the following question: who wins the game?

Input

The first line contains the number of test cases T (1 ?≤? T ?≤? 20). Each of the next T lines contains an integer (1 ?≤? N ?≤?1,000,000,000).

Output

Output T lines, one for each test case, containing Alice if Alice wins the game, or Bob otherwise.

Examples
input
2
5
1
output
Alice
Bob

博弈论题目。1就是Bob赢否则就是Alice赢,不知道怎么来的,算了8个发现只有1是Bob赢就这样写了,没想到还真过了。

 1 #include <iostream>
 2 #include <stdio.h>
 3 #include <string.h>
 4 #include <algorithm>
 5 #define ll long long
 6 using namespace std;
 7 int main(){
 8     int t,n;
 9     cin>>t;
10     while(t--){
11         cin>>n;
12         if(n == 1){
13             cout << "Bob\n";
14         }else cout << "Alice\n";
15     }
16     return 0;
17 }

 


Gym - 100952G

原文:http://www.cnblogs.com/xingkongyihao/p/7197312.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!