1.5编程基础之循环控制_06整数序列的元素最大跨度值

  • Post author:
  • Post category:其他

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))

 https://blog.csdn.net/weixin_45852964/category_9499761.html


版权声明:本文为dllglvzhenfeng原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。