Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
117392 | 翁思宸 | 最大值与最小值的差 | C++ | Accepted | 1 MS | 276 KB | 491 | 2025-04-18 19:31:09 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int a[10000],n,q=0,p=99999,s; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; if(a[i]>q){ q=a[i]; } if(a[i]<p){ p=a[i]; } } cout<<q-p; return 0; }