当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

4371:Alice and Bob

题目描述
Alice and Bob are interested in playing games. One day, they invent a game which has rules below:
1. Firstly, Alice and Bob choose some random positive integers, and here we describe them as n, d1, d2,..., dm.
2. Then they begin to write numbers alternately. At the first step, Alice has to write a “0”, here we let s1 = 0 ; Then, at the second step, Bob has to write a number s2 which satisfies the condition that s2 = s1 + dk and s2 <= n, 1<= k <= m ; From the third step, the person who has to write a number in this step must write a number si which satisfies the condition that si = si-1 + dk or si = si-1 - dk , and si-2 < si <= n, 1 <= k <= m, i >= 3 at the same time.
3. The person who can’t write a legal number at his own step firstly lose the game.
Here’s the question, please tell me who will win the game if both Alice and Bob play the game optimally.
输入解释
At the beginning, an integer T indicating the total number of test cases.
Every test case begins with two integers n and m, which are described before. And on the next line are m positive integers d1, d2,..., dm.
T <= 100;
1 <= n <= 106;
1 <= m <= 100;
1 <= dk <= 106, 1 <= k <= m.
输出解释
For every test case, print “Case #k: ” firstly, where k indicates the index of the test case and begins from 1. Then if Alice will win the game, print “Alice”, otherwise “Bob”.
输入样例
2
7 1
3
7 2
2 6
输出样例
Case #1: Alice
Case #2: Bob
来自杭电HDUOJ的附加信息
Author standy from UESTC
Recommend zhuyuanchen520

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-4371

最后修改于 2020-10-25T23:12:54+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)