![]() |
||||||||||
|
||||||||||
happy happy happyTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1262 Accepted Submission(s): 360 Problem Description Today, Bob plays with a child. There is a row of $n$ numbers. One can takes a number from the left side or the right side in turns and gets the grade which equals to the number. Bob knows that the child always chooses the bigger number of the left side and right side. If the number from two sides is equal, child will always choose the left one. The child takes first and the person who gets more grade wins. The child will be happy only when he wins the game. Bob wants to make the child happy, please help him calculate the minimal difference of their grades when he loses the game. Input There are T test cases ($T\leq 2$). For each test case: the first line only contains a number $n$ ($1\leq n \leq 90\&\&n\%2==0$) The second line contains $n$ integers: $a_1, a_2\dots a_n(1\leq a_i\leq 10^5)$. Output For each test ease, you should output the minimal difference of their grades when Bob loses the game. If Bob can't lose the game, output "The child will be unhappy...". Sample Input
Sample Output
Source | ||||||||||
|