提交时间:2024-04-19 13:07:24

运行 ID: 143839

#include<bits/stdc++.h> using namespace std; int n,minn,x,a[1001]; int main(){ cin>>n; for(int i=1;i<=n;i++)cin>>a[i]; minn=a[1]; for(int i=1;i<=n;i++){ if(a[i]>minn)x=max(x,a[i]-minn); minn=min(minn,a[i]); } cout<<x; return 0; }