#K8596. Longest Arithmetic Progression
Longest Arithmetic Progression
Longest Arithmetic Progression
This problem requires you to determine the length of the longest arithmetic progression (AP) that can be formed using the integers 1 through n inclusive. An arithmetic progression is a sequence of numbers in which the difference between consecutive numbers is constant. In this particular case, if you use all the integers from 1 to n, the longest arithmetic progression you can obtain is simply the sequence 1, 2, 3, ..., n, whose length is n.
Your task is to output the length of this progression.
Note: The input consists of a single integer n. Since the arithmetic progression using all numbers from 1 to n is the longest possible, the answer is always n.
Example:
- If the input is
9
, then the output should be9
.
inputFormat
The input consists of a single line containing one integer n
(1 ≤ n ≤ 105).
outputFormat
Output a single integer — the length of the longest arithmetic progression that can be formed using the numbers from 1 to n (which is n itself).
## sample9
9