21711_Alice'sGame

2022-5-16 18:20| 发布者: Hocassian| 查看: 24| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505780610900-Problem List-采集的数据-后羿采集器.html

Pro.ID

21711

Title

Alice's Game

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21711

AC

5

Submit

7

Ratio

71.43%

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/32768 K (Java/Others)
  • 描述

    Alice and Bob have got a lot of chocolates. All the chocolates are rectangles of different shapes as Xi × Yi. They decide to play an interesting game on the chocolates. They take turns choose a chocolate and split it into two pieces. The one who can not take operations lose. Due to the game is too simple, the additional rules apply. Alice is only allowed to split the chocolate vertically, and Bob is only allowed to split the chocolate horizontally.

    Specifically, for Alice, a chocolate Xi × Yi, can only split into A × Yi, and B × Yi where A + B = Xi and A, B > 0. And for Bob, a chocolate Xi × Yi, can only split into Xi × A, and Xi × B where A + B = Yi and A, B > 0.

    Alice and Bob are clever enough to take the optimal operation, if Alice plays first, your are to decide who will win.

    输入

    The input contains multiple test cases. The first line of input contains a single integer denoting the number of test cases.

    For each test case, the first line contains an integer N, the number of pieces of chocolates. (1 ≤ N ≤ 100)

    For the next N lines, each line contains two integers Xi and Yi, denoting the chocolate sized Xi × Yi. (1 ≤ Xi, Yi ≤ 1000000000)

    输出

    Description

    Alice and Bob have got a lot of chocolates. All the chocolates are rectangles of different shapes as Xi × Yi. They decide to play an interesting game on the chocolates. They take turns choose a chocolate and split it into two pieces. The one who can not take operations lose. Due to the game is too simple, the additional rules apply. Alice is only allowed to split the chocolate vertically, and Bob is only allowed to split the chocolate horizontally.

    Specifically, for Alice, a chocolate Xi × Yi, can only split into A × Yi, and B × Yi where A + B = Xi and A, B > 0. And for Bob, a chocolate Xi × Yi, can only split into Xi × A, and Xi × B where A + B = Yi and A, B > 0.

    Alice and Bob are clever enough to take the optimal operation, if Alice plays first, your are to decide who will win.

    Input

    The input contains multiple test cases. The first line of input contains a single integer denoting the number of test cases.

    For each test case, the first line contains an integer N, the number of pieces of chocolates. (1 ≤ N ≤ 100)

    For the next N lines, each line contains two integers Xi and Yi, denoting the chocolate sized Xi × Yi. (1 ≤ Xi, Yi ≤ 1000000000)

    Output

    For each test cases, output "Alice" when Alice will win, and "Bob" otherwise. See sample test cases for further details.

    Sample Input

    4
    1
    1 1
    1
    2 1
    2
    2 2
    2 1
    1
    3 2

    Sample Output

    Case 1: Bob
    Case 2: Alice
    Case 3: Alice
    Case 4: Bob

    Source

    样例输入

    4
    1
    1 1
    1
    2 1
    2
    2 2
    2 1
    1
    3 2

    样例输出

    Case 1: Bob
    Case 2: Alice
    Case 3: Alice
    Case 4: Bob

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部