#K52617. Longest Arithmetic Subarray
Longest Arithmetic Subarray
Longest Arithmetic Subarray
Given an array of positive integers, your task is to find the length of the longest contiguous subarray (i.e. segment) that forms an arithmetic progression. An arithmetic progression is a sequence of numbers in which the difference between consecutive elements is constant. In mathematical notation, for a subarray a[i], a[i+1], ..., a[j], the condition is given by:
\( a_{k+1} - a_k = d \) for all \( k \) such that \( i \leq k < j \).
Your program should read the input from standard input (stdin) and print the result to standard output (stdout).
inputFormat
The first line of input contains an integer n representing the number of elements in the array. The second line contains n space-separated positive integers.
outputFormat
Output a single integer representing the length of the longest contiguous subarray that forms an arithmetic progression.
## sample1
1
1