tj
2025-05-20 22:07:19
发布于:浙江
9阅读
0回复
0点赞
#include<iostream>
using namespace std;
int a[200010];
int main(){
int n,largest=0,smallest=1000000000;
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
if(a[i]<smallest){
smallest=a[i];
}
if(a[i]>largest){
largest=a[i];
}
}
cout<<largest-smallest;
return 0;
}
这里空空如也
有帮助,赞一个