Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
155778 李嘉峻 最大值与最小值的差 C++ Accepted 1 MS 276 KB 338 2026-06-13 14:31:39

Tests(10/10):


Code:

#include <bits/stdc++.h> using namespace std; int a[10000]; int main () { int n; cin>>n; for(int i = 1;i<=n;i++){ cin>>a[i]; } int t = -10001; int f = 10002; for(int i =1;i<=n;i++){ if(a[i]>t) { t = a[i]; } } for(int i =1;i<=n;i++){ if(a[i]<f) { f = a[i]; } } cout<<t-f; return 0; }