問題一覧 > 通常問題

No.103 Prime Factor Game Returns

レベル : / AI推定難易度 : 1475 / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 301
作問者 : yuki2006
お気に入りにしたユーザー ProblemId : 187 / 自分の提出
問題文最終更新日: 2026-06-28 19:25:51
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 65 (順位表) の他の問題:

Problem Statement

Alice and Bob, who learned about prime factors just a little while ago, are playing a number game again.

The rules of the game are as follows.
・You are given $N$ integers, denoted $M_1\ M_2\ \dots M_i \dots \ M_N$.
・The player whose turn it is chooses the $i$-th number among the $N$ integers, divides it by one of the "prime factors of \(M_i \)", and updates the $i$-th number with the quotient.
・In doing so, the player may divide by the same prime factor at least 1 time and at most $2$ times, as long as it is divisible.
For example, if the $i$-th value is \(24\), its prime factors are \(2,3\ (24 = 2 \times 2 \times 2 \times 3) \), so it is possible to update \(24\) to \(6\), the number obtained by dividing it by \(2\) \(2\) times.
・The players take turns repeating the above procedure, and the player who makes all $N$ numbers equal to \(1\) wins.


Alice goes first and starts the game.
Assuming both players play optimally, determine the winner for the given $N$ integers.

Input

$N$
$M_1\ M_2\ \dots M_i \dots \ M_N$

All input values are given as integers.
\( 1 \leq N \leq 100 \)
\( 2 \leq M_i \leq 10,000=10^4 \)

Output

Print the winning player, as the string "Alice" or "Bob", on one line.
Print a newline at the end.

Sample

Sample 1
Input
1
4
Output
Alice

Alice divides \(4\) by its prime factor \(2\) $2$ times and updates it to $1$.
At this point, Alice wins.

Sample 2
Input
2
11 19
Output
Bob

Since both $11$ and $19$ are prime, Bob wins.

Sample 3
Input
1
24
Output
Alice

Alice updates \(24\) by dividing it by \(2^2\), obtaining \(6\).
Bob divides it by \(2\) or \(3\).
The value is now \(2\) or \(3\), and since either one is a prime factor, Alice divides by it and everything becomes 1, so Alice wins.

Sample 4
Input
4
600 1200 1800 2400
Output
Bob

In fact, no matter how Alice divides, Bob has a way to win.

Sample 5
Input
2
6 23
Output
Alice

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。