【例61.2】 最近的一对
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Description
Given an array containing elements, find the pair of indices and in that are closest to each other, satisfying and . If multiple pairs exist, output the value of corresponding to the smallest . For example, in the array of numbers , the numbers that satisfy include . Among these, the pairs and are closer in distance, and in the case of equal distances, has a smaller index. If no identical numbers exist, output "No".
Input Format
The first line contains a single integer representing the length of the array ().
The next lines each contain a single integer, representing the elements of the array ().
Output Format
Output the value of corresponding to the smallest that meets the conditions.
Sample
10
19
13
11
19
11
5
6
3
4
311
20250915D班作业(1)
- Status
- Done
- Problem
- 4
- Open Since
- 2025-9-14 0:00
- Deadline
- 2025-9-22 23:59
- Extension
- 24 hour(s)