题解 | 最大的差
最大的差
https://www.nowcoder.com/practice/0cc49c97703d471dae00b43a5649e4f9
#include <iostream>
using namespace std;
int main() {
int n;
cin>>n;
int max,min;
int temp;
cin>>temp;
max=min=temp;
while(--n)
{
cin>>temp;
if(temp>=max)
{
max=temp;
}
else if(temp<=min)
{
min=temp;
}
}
cout<<max-min<<endl;
return 0;
}
#新手#
查看19道真题和解析
顺丰集团工作强度 276人发布