题意
无非就是输入,排序(从小到大)再输出嘛,简单
解析
见标程
标程
#import <bits/stdc++.h>//万能头文件
using namespace std;//使用标准命名空间
int main(){//主程序
ios::sync_with_stdio(false);//见P2274数组交换1
cin.tie(nullptr);//同上
long long n,a[100005];//用long long,不怕越界
cin>>n;
for(int i=1;i<=n;i++){cin>>a[i];}
sort(a+1,a+n+1);//排序(从小到大)(详细见P2323 第k大和第k小的数)
cout<<a[n]-a[1];//输出
return 0;//别忘了return 0;
}
后记
空空如也

被折叠的 条评论
为什么被折叠?



