10049_ArithmeticProgression

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

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

Pro.ID

10049

Title

Arithmetic Progression

Title链接

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

AC

42

Submit

123

Ratio

34.15%

时间&空间限制

  • Time Limit: 4000/2000 MS (Java/Others)     Memory Limit: 65536/32768 K (Java/Others)
  • 描述

    "In mathematics, an arithmetic progression (AP) or arithmetic sequence is a sequence of numbers such that the difference between the consecutive terms is constant. For instance, the sequence 5, 7, 9, 11, 13, … is an arithmetic progression with common difference of 2."

    ----Wikipedia

    This is a quite simple problem, give you the sequence, you are supposed to find the length of the longest consecutive subsequence which is an arithmetic progression.

    输入

    There are several test cases. For each case there are two lines. The first line contains an integer number N ( 1 ≤ N ≤ 100000 ) indicating the number of the sequence. The following line describes the N integer numbers indicating the sequence, each number will fit in a 32bit signed integer.

    输出

    Description

    "In mathematics, an arithmetic progression (AP) or arithmetic sequence is a sequence of numbers such that the difference between the consecutive terms is constant. For instance, the sequence 5, 7, 9, 11, 13, … is an arithmetic progression with common difference of 2."

    ----Wikipedia

    This is a quite simple problem, give you the sequence, you are supposed to find the length of the longest consecutive subsequence which is an arithmetic progression.

    Input

    There are several test cases. For each case there are two lines. The first line contains an integer number N ( 1 ≤ N ≤ 100000 ) indicating the number of the sequence. The following line describes the N integer numbers indicating the sequence, each number will fit in a 32bit signed integer.

    Output

    For each case, please output the answer in one line.

    Sample Input

    6
    1 4 7 9 11 14

    Sample Output

    3

    样例输入

    6
    1 4 7 9 11 14

    样例输出

    3

    提示

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部