提交时间:2024-11-11 21:48:11

运行 ID: 56405

#include<bits/stdc++.h> using namespace std; int main() { int n,max,minn,a; cin>>n; cin>>a; max=a; minn=a; for(int i=2;i<=n;i++) { cin>>a; if(max<=a) max=a; if(minn>=a) minn=a; } cout<<max-minn; return 0; }