22790_PolynomialEstimates

2022-5-16 18:22| 发布者: Hocassian| 查看: 18| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506960858700-Problem List-采集的数据-后羿采集器.html

Pro.ID

22790

Title

Polynomial Estimates

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22790

AC

3

Submit

5

Ratio

60.00%

时间&空间限制

  • Time Limit: 1000/500 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    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
    1 3
    5 0 1 2 3 4
    5 0 1 2 4 5

    Sample Output

    YES
    YES
    NO

    Source

    样例输入

    3
    1 3
    5 0 1 2 3 4
    5 0 1 2 4 5

    样例输出

    YES
    YES
    NO

    提示

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部