eolymp
bolt
Попробуйте наш новый интерфейс для отправки задач
Задачи

Sequence Folding

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: \begin{enumerate} \item - Generate a random integer \textbf{N} ≥ \textbf{2}. \item - Generate a sequence of \textbf{N} random integers. \item - If \textbf{N = 2} go to step \textbf{6}. \item - Fold the sequence by adding the \textbf{N}_th element to the first, the \textbf{N-1}_th element to the second and so on, if \textbf{N} is odd then the middle element is added to itself, figure \textbf{1} illustrates the folding process. \item - Set \textbf{N = ceil (N/2)} and go to step \textbf{3}. \item - The sequence now contains two numbers, if the first is greater than the second then Alice wins, otherwise Bob wins. \end{enumerate} \includegraphics{https://static.e-olymp.com/content/ce/ceb454b9fd545c9e12c0bef8ded554239bc26786.jpg} Figure 1.a Before Folding \includegraphics{https://static.e-olymp.com/content/26/2601052045683844b5c7ae820413b3a1e1525007.jpg} Figure 1.b After one step of folding \includegraphics{https://static.e-olymp.com/content/b0/b05fe19b41163c9e50505c4de5f5d9841d399902.jpg} Figure 1.c After two steps of folding, Alice wins! In this problem you’re given the sequence of \textbf{N} integers and are asked determine the contest winner using the sequence folding tie breaker technique. \InputFile The first line contains \textbf{T} (\textbf{1} ≤ \textbf{T} ≤ \textbf{100}), the number of test cases. The first line of each test case contains an integer (\textbf{2} ≤ \textbf{N} ≤ \textbf{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 \textbf{32} bit signed integer. \OutputFile For each test case print the name of the winner. Follow the output format below.
Лимит времени 1 секунда
Лимит использования памяти 64 MiB
Входные данные #1
2
5
2 5 10 3 -4
3
5 4 -3
Выходные данные #1
Case #1: Alice
Case #2: Bob
Источник The Third Lebanese Collegiate Programming Contest