题库练习 Reconnaissance 2
← 上一题 下一题 →

A7949 | Reconnaissance 2

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

$n$ soldiers stand in a circle. For each soldier his height $a_{i}$ is known. A reconnaissance unit can be made of such two neighbouring soldiers, whose heights difference is minimal, i.e. $|a_{i}-a_{j}|$ is minimal. So each of them will be less noticeable with the other. Output any pair of soldiers that can form a reconnaissance unit.

输入格式

The first line contains integer $n$ ( $2<=n<=100$ ) — amount of soldiers. Then follow the heights of the soldiers in their order in the circle — $n$ space-separated integers $a_{1},a_{2},...,a_{n}$ ( $1<=a_{i}<=1000$ ). The soldier heights are given in clockwise or counterclockwise direction.

输出格式

Output two integers — indexes of neighbouring soldiers, who should form a reconnaissance unit. If there are many optimum solutions, output any of them. Remember, that the soldiers stand in a circle.

输入输出样例

输入 #1
5
10 12 13 15 10
输出 #1
5 1
输入 #2
4
10 20 30 40
输出 #2
1 2
C++ 编辑器
输入
输出