-->
当前位置:首页 > 题库

PROGRAMMING:Eat Grapes

Luz5年前 (2021-05-10)题库506
*The party began, the greasy uncle was playing cards, the fat otaku was eating, and the little beauty was drawing.*
After eating steaks and tasting desserts, the party is coming to an end. The host has prepared many fruits for everyone. SYH tempts to eating grapes, but now another person is eating.
The basic shape of a bunch of grapes is a long chain composed of $$N$$ small grapes. On this chain, each grape can be regarded as a node. In addition to being connected to the next node, each node may have **several grapes attached on it**, and the node at the end of the long chain **always** have a grape connected on. This grape is **excluded** the number of grapes at the end node.
The two participants take turns to take grapes, **$$SYH$$ takes first**. During one move, the participant can take away any positive number of grapes connected to the **end node**. When all the grapes connected to the end node are taken, the last node is considered to be the grape connected on the penultimate(second last) one, and the total number of nodes is reduced by $$1$$.
For the same reason as in *Dessert Time*, neither of them want to take the last grape. However, $$SYH$$ is very smart; he observed the shape of the grapes in advance. If $$SYH$$ found out that he would lose, he would say `"these are sour grapes"` and leave early. Otherwise, he would say `"these are sweet grapes"` and then eat deliciously. Do you know what $$SYH$$ said?
Given a number $$N$$ and an array $$a$$, the meaning is described as above, you should print the sentence which $$SYH$$ said.
### Input Specification:
There are multiple test cases. The first line of input contains an integer $$T$$ ($$1$$ ≤ $$T$$ ≤ $$10$$), indicating the number of test cases. For each test case:
The first line contains an integer $$N$$ ($$1$$ ≤ $$N$$ ≤ $$10^5$$), indicating the number of nodes.
The second line contains $$N$$ integers, $$a_ 1$$ , $$a_ 2$$ ,……, $$a_ n$$ ($$0$$ ≤ $$a_ i$$ ≤ $$10^9$$), indicating the number of grapes connected to the $$i$$-th node.
### Output Specification:
For each test case, each line contains a string, indicating the sentence which $$SYH$$ said.
### Sample Input:
```in
two
five
2 1 0 0 1
five
1 1 0 1 0
```
### Sample Output:
```out
these are sweet grapes
these are sour grapes
```
### Hint:
For the first sample, the figure below is the case of $$N=5$$ and $$a={2,1,0,0,1}$$.
![ The improvement of sour or sweet's question chart. PNG] (~ / 49269312-67ee-468c-88d8-650b35933655. PNG) < br > < br > < br > < br > < br > the improvement of sour or sweet's question chart


answer:If there is no answer, please comment