"Well, and? Details! I mean, not details, I don't need a diagram. But, you know, like maybe a blurry watercolor." |
Given a sorted set of n+1 even numbers S = (s_{0}, s_{1}, ..., s_{n}), it is easy to construct the corresponding set of n midpoints, M = (m_{1}, m_{2}, ..., m_{n}), where each m_{i} is the average of the i'th and (i-1)'th elements of S. Your task is, given a set of integers, M, to determine whether it is possible for M to be a set of midpoints for some set of even integers S. No two elements of S can be the same.
Input
The first line of input gives the number of cases, N.
N test cases follow. Each one starts with a line containing
n (0<=n<=10000). The next line will contain
the integers m_{1} through m_{n} in sorted
order, each one between -100000000 and 100000000.
Output
For each test case, output one line containing "Case #x:"
followed by either "YES" or "NO".
Sample Input | Sample Output |
4 0 2 7 13 10 1 3 5 7 9 11 13 15 17 19 6 1 10 11 20 21 30 |
Case #1: YES Case #2: YES Case #3: YES Case #4: NO |