http://noi.openjudge.cn/ch0105/06/
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
int n, data, top=0, bottom=1001;
cin >> n;
for (int i=0; i<n; i++)
{
cin >> data;
if (data > top) top = data;
if (data < bottom) bottom = data;
}
cout << top-bottom << endl;
return 0;
}
python3代码
"""
1.5编程基础之循环控制 06 整数序列的元素最大跨度值
http://noi.openjudge.cn/ch0105/06/
https://blog.csdn.net/weixin_45852964/article/details/103199313
https://blog.csdn.net/weixin_45852964/article/details/103375233
https://blog.csdn.net/weixin_45852964/article/details/103586946
https://blog.csdn.net/weixin_45852964/article/details/103481658
"""
n = int(input())
z = list(map(int,input().split()))
print(max(z)-min(z))