#P8682. [蓝桥杯 2019 省 B] 等差数列
[蓝桥杯 2019 省 B] 等差数列
Description
The math teacher gave Xiao Ming a problem about summing an arithmetic progression. However, the careless Xiao Ming forgot part of the sequence and only remembers integers.
Now these integers are given. Xiao Ming wants to know: how many terms does the shortest arithmetic progression that contains all these integers have?
Input Format
The first line contains an integer .
The second line contains integers (note that are not necessarily given in the order they appear in the arithmetic progression).
Output Format
Output one integer, the answer.
5
2 6 4 10 20
10
Hint
The shortest arithmetic progression that contains 2,6,4,10,20 is 2,4,6,8,10,12,14,16,18,20.
For all test cases, , .
Lanqiao Cup 2019 Provincial Contest B Group, Problem H.
Translated by ChatGPT 5
京公网安备 11011102002149号