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

建议使用的浏览器:

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

4134:Sequence Folding

题目描述
Alice and Bob are practicing hard for the new ICPC season. They hold many private contests where only the two of them compete against each other. They almost have identical knowledge and skills, the matter which results many times in ties in both the number of problems solved and in time penalty! To break the tie, Alice and Bob invented a tie breaker technique called sequence folding! The following are the steps of this technique:
1- Generate a random integer N >= 2.
2- Generate a sequence of N random integers.
3- If N = 2 go to step 6.
4- Fold the sequence by adding the Nth element to the first, the N-1th element to the second and so on, if N is odd then the middle element is added to itself, figure 1 illustrates the folding process.
5- Set N = ceil (N/2) and go to step 3.
6- The sequence now contains two numbers, if the first is greater than the second then Alice wins, otherwise Bob wins.


Figure 1.a Before Folding


Figure 1.b After one step of folding


Figure 1.c After two steps of folding, Alice wins!


In this problem you’re given the sequence of N integers and are asked determine the contest winner using the sequence folding tie breaker technique.
输入解释
The first line contains T (1 <= T <= 100), the number of test cases. The first line of each test case contains an integer (2 <= N <= 100), the number of elements of the sequence. The next line contains N space separated integers. The sum of any subset of the numbers fit in a 32 bit signed integer.
输出解释
For each test case print the name of the winner. Follow the output format below.
输入样例
2
5
2 5 10 3 -4
3
5 4 -3
输出样例
Case #1: Alice
Case #2: Bob
来自杭电HDUOJ的附加信息
Recommend lcy

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

源链接: HDU-4134

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

共提交 0

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