提交时间:2024-10-27 15:52:55

运行 ID: 54370

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