提交: 18 解决: 1

[提交] [状态] [讨论版] [命题人:]

题目描述

shihu likes to play stone game.There are n piles of stones, numbered with 0,1,2, ..., n-1. Two persons pick stones in turn. In every turn, each person selects three piles of stones numbered i, j, k (i < j, j ≤ k and at least one stone left in pile i). Then, the person gets one stone out of pile i, and put one stone into pile j and pile k respectively. (Note: if j = k, it will be the same as putting two stones into pile j). One will fail if he can’t pick stones according to the rule

shihu is the player who first picks stones and he hopes to win the game. Can you write a program to help him?

The number of piles, n, does not exceed 55. The number of stones in each pile does not exceed 100000.Suppose the opponent player is very smart and he will follow the optimized strategy to pick stones.

输入

Input contains several cases. Each case has two lines. The first line contains a positive integer n

(1 ≤ n ≤ 55) indicating the number of piles of stones. The second line contains n non-negative integers separated by blanks, S0, . . . , Sn-1 (0 ≤ Si ≤ 100000), indicating the number of stones in pile 0 to pile n - 1 respectively.

输出

For each case, if shihu can win, output "YES",And if there are no strategies to win the game, output "NO".

样例输入
Copy

```
3
1 0 5
2
2 1
```

样例输出 Copy

```
YES
NO
```