#P9278. [AGM 2023 资格赛] 另一个游戏

[AGM 2023 资格赛] 另一个游戏

Problem Description

Charlie and Dan are playing a game on NN piles of stones numbered from 11 to NN from left to right. Each pile contains a positive number of stones.

They take turns making moves, and Charlie moves first.

On each turn, a player takes a positive number of stones from the leftmost non-empty pile and moves them to the adjacent pile on the right. If, on a player's turn, the only non-empty pile is pile NN, then that player loses the game.

If both players play optimally, who will win the game?

Input Format

The first line of input contains an integer N(2N103)N(2 \le N \le 10^3), the number of piles.

The next line contains NN integers v1,v2,v3,...,vn(1vi109)v_1, v_2, v_3, ..., v_n(1 \le v_i \le 10^9), representing the number of stones in each pile.

Output Format

Output the name of the player who wins.

3
2 2 2
Charlie

Hint

Translated by ChatGPT 5