题目链接:https://ac.nowcoder.com/acm/contest/877/G
时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 131072K,其他语言262144K
64bit IO Format: %lld

题目描述

The two new cute boys(Alice and Bob) in the ACM group of HLJU science and technology association have been dreaming of getting these six books written by Mr Jin.

 

As we all know, there is no such thing as a free lunch. Mr Jin now lets Alice and Bob play a game,and only the winner of the game can get these six books.The rules of the game are as follows.

 Suppose(假设) the price of these six books is P, two people take turns in bidding(竞拍), Suppose one party(一方) bid A yuan during the bidding process and the other party(另一方) bid B yuan. Rules require . In this way, the bidding goes on in turn until the price of one party is greater than or equal toP,the party fails and the game ends, Mr Jin awarded these books to another party.

Alice first bid, Bob bid behind him every time, and Alice and Bob use the best strategy(最优策略), who can get these books?

输入描述

输出描述

输入

4
1 1
20 6
10 2
23 7

输出

Bob
Alice
Bob
Alice

解题思路

题意:有一拍卖品成交价为P,两人轮流出价,至少加价1,最多加价M,两个人都足够聪明,求最后谁会拍下这个拍卖品.
思路:巴什博奕,当且仅当(n-1)%(m+1)==0时Bob能赢。

#include <bits/stdc++.h>
using namespace std;
int main() {
    int t, n, m;
    scanf("%d",&t);
    while(t--) {
        scanf("%d%d", &n, &m);
        if ((n - 1) % (m + 1))
            printf("Alice\n");
        else printf("Bob\n");
    }
    return 0;
}