P15779 [CodeChef] CCGAME
提高-
题目描述

There is a non-negative integer array A of length N. Chef and Cook will play a game on the array with Chef starting first.

In one turn the player will perform the following operation:

Choose two indices i,j such that 1 ≤ i < j ≤ N and A_{i} > 0.
Set A_{i} ⬅ A_{i} - 1 and A_{j} ⬅ A_{j} + 1, i.e, subtract 1 from A_{i} and add 1 to A_{j}.

The player who is unable to perform the operation loses. If both Chef and Cook play optimally, who will win?

------ Input Format ------

  • The first line of input will contain a single integer T, denoting the number of test cases.
  • The first line of each test case contains a single integer N denoting the length of the array.
  • The second line of teach test case contains $N integers A_{1},A_{2},\ldots,A_{N}$ denoting the initial values of the array.

------ Output Format ------

For each test case, output "Chef" if Chef wins, otherwise output "Cook" (without quotes).

Each letter of the output may be printed in either uppercase or lowercase. For example, Chef, chEf, CHEF, and cHEf will all be treated as equivalent.

------ Constraints ------

$1 ≤ T ≤ 1000$
$1 ≤ N ≤ 100$
$0 ≤ A_{i} ≤ 10^{9}$
- There are no limits on the sum of $N$ over all test cases.

----- Sample Input 1 ------
3
4
1 0 1 0
4
1 2 3 4
1
420

----- Sample Output 1 ------
Chef
Chef
Cook

----- explanation 1 ------
For the first test case, Chef wins. Here is the strategy for Chef.

  • Initially, $A = [1, 0, 1, 0]$.
  • In the first turn, Chef will pick $i=1$ and $j=3$. Then, $A = [0,0,2,0]$.
  • In the second turn, Cook is can only pick $i=3$ and $j=4$. Then $A=[0,0,1,1]$.
  • In the third turn, Chef will pick $i=3$ and $j=4$. Then $A=[0,0,0,2]$.
  • In the fourth turn, Cook cannot perform any operation and loses. Therefore, Chef has won.
输入格式

见题面

输出格式

见题面

样例输入
3 4 1 0 1 0 4 1 2 3 4 1 420
样例输出
Chef Chef Cook