AtCoder Beginner Contest 102
B
Maximum Difference
AtCoder
⌀ 0
原题
← AC →
翻译中…

Problem Statement

翻译中…

You are given an integer sequence $A$ of length $N$. Find the maximum absolute difference of two elements (with different indices) in $A$.

翻译中…

Constraints

翻译中…
  • $2 \leq N \leq 100$
  • $1 \leq A_i \leq 10^9$
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N
A_1 A_2 ... A_N

翻译中…

Output

翻译中…

Print the maximum absolute difference of two elements (with different indices) in $A$.

翻译中…

样例

Input #1
4
1 4 6 3
Output #1
5
The maximum absolute difference of two elements is $A_3-A_1=6-1=5$.
Input #2
2
1000000000 1
Output #2
999999999
Input #3
5
1 1 1 1 1
Output #3
0
题目信息
题号
abc102_b
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。