HBC200153Arithmetic Progressions题解

旧巴黎 算法基础篇 52 0
想要检验自己的编程水平?来试试全网最全C++题库,让您在挑战中不断进步。
An arithmetic progression is a sequence of numbers a1, a2, ..., ak where the dierence of consecutive members ai+1ai is a constant . For example, the sequence 5, 8, 11, 14, 17 is an arithmetic progression of length 5 with the common dierence 3.In this problem, you are requested to nd the longest arithmetic progression which can be formed selecting some numbers from a given set of numbers. For example, if the given set of numbers is {0, 1, 3, 5, 6, 9}, you can form arithmetic progressions such as 0, 3, 6, 9 with the common dierence 3, or 9, 5, 1 with the common dierence 4. In this case, the progressions 0, 3, 6, 9 and 9, 6, 3, 0 are the longest.

An arithmetic progression is a sequence of numbers a1, a2, ..., ak where the difference of consecutive members ai+1−ai is a constant (1 ≤ i ≤ k−1). For example, the sequence 5, 8, 11, 14, 17 is an arithmetic progression of length 5 with the common difference 3. In this problem, you are requested to find the longest arithmetic progression which can be formed selecting some numbers from a given set of numbers. For example, if the given set of numbers is {0, 1, 3, 5, 6, 9}, you can form arithmetic progressions such as 0, 3, 6, 9 with the common difference 3, or 9, 5, 1 with the common difference −4. In this case, the progressions 0, 3, 6, 9 and 9, 6, 3, 0 are the longest.

HBC200153Arithmetic Progressions题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
成为编程大师,不再是梦想!全网最全C++题库,助您开启编程新篇章。

标签: HBC200153Arithmetic Progressions题解