Pro.ID22790 TitlePolynomial Estimates Title链接http://10.20.2.8/oj/exercise/problem?problem_id=22790 AC3 Submit5 Ratio60.00% 时间&空间限制描述The number of spectators at the FIFA World Cup increases year after year. As you sell the advertisement slots during the games for the coming years, you need to come up with the price a company has to pay in order to get an advertisement slot. For this, you need a good estimate for the number of spectators in the coming games, based on the number of spectators in the past games. Your intuition tells you that maybe the number of spectators could be modeled precisely by a polynomial of degree at most 3. The task is to check if this intuition is true. 输入The input starts with a positive integer N, the number of test cases. Each test case consists of one line. The line starts with an integer 1 ≤ n ≤ 500, followed by n integers x1, … , xn with 0 ≤ xi ≤ 50000000 for all i, the number of spectators in past games. 输出Description The number of spectators at the FIFA World Cup increases year after year. As you sell the advertisement slots during the games for the coming years, you need to come up with the price a company has to pay in order to get an advertisement slot. For this, you need a good estimate for the number of spectators in the coming games, based on the number of spectators in the past games. Your intuition tells you that maybe the number of spectators could be modeled precisely by a polynomial of degree at most 3. The task is to check if this intuition is true. Input The input starts with a positive integer N, the number of test cases. Each test case consists of one line. The line starts with an integer 1 ≤ n ≤ 500, followed by n integers x1, … , xn with 0 ≤ xi ≤ 50000000 for all i, the number of spectators in past games. Output For each test case, print "YES" if there is a polynomial p (with real coefficients) of degree at most 3 such that p(i) = xi for all i. Otherwise, print "NO". Sample Input 3 Sample Output YES Source 样例输入3 样例输出YES 作者 |