You are given an array of length
. You are required to count the number of
such that the difference of the array elements on that indices is equal to the sum of the square of their indices.
That is the count of the number of pairs of
such that it satisfies this equation (
- The first line contains the length of the array . ()
- The second line contains integers representing array elements. ()
Print the number of pairs that satisfy the provided condition.
Pairs at indices : (1,2), (2,4), (1,5) satisfy the above condition.
You can submit this solution is in c++,c++14 and c++17