提交时间:2024-01-02 13:10:57
运行 ID: 118868
#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; }