Run ID:76054

提交时间:2024-06-01 15:40:56

#include <iostream> #include <iomanip> using namespace std; int main(){ int n,mxx = 0,ndd = 10000; cin>>n; int a[1001]; for(int i=1;i<=n;i++){ cin>>a[i]; } for(int i=1;i<=n;i++){ if(mxx<a[i]){ mxx = a[i]; } if(ndd>a[i]){ ndd = a[i]; } } cout<<mxx-ndd; }