Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
106061 何睿函 最大值与最小值的差 C++ Time Limit Exceeded 1000 MS 260 KB 308 2025-01-15 12:43:23

Tests(0/10):


Code:

#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;1<M;i++){ if(a[i]>x){ x=a[i]; } } int y=a[0]; for(int i=1;1<M;i++){ if(a[i]<y){ y=a[i]; } } cout<<x-y; return 0; }