Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
106062 | 何睿函 | 最大值与最小值的差 | C++ | Accepted | 1 MS | 268 KB | 308 | 2025-01-15 12:44:45 |
#include<bits/stdc++.h> using namespace std; int main(){ int M; cin>>M; int a[M]; for(int i=0;i<M;i++){ cin>>a[i]; } int x=a[0]; for(int i=1;i<M;i++){ if(a[i]>x){ x=a[i]; } } int y=a[0]; for(int i=1;i<M;i++){ if(a[i]<y){ y=a[i]; } } cout<<x-y; return 0; }