文章
117
粉丝
69
获赞
860
访问
113.6k
#include<iostream>
#include<algorithm>
#include<limits.h>
#include<cmath>
#include<cstring>
#include<vector>
#include<string>
using namespace std;
const int N = 1010;
int p[N];
int n;
int main()
{
while(cin >> n)
{
int t = N, s = 0, ans = 0;
for(int i = 1; i <= n; i ++)
{
int x; scanf("%d", &x);
if(x >= s) t = min(t, x), s = x;
else t = x, s = 0;
if(s) ans = max(ans, abs(t - s));
}
printf("%d\n", ans);
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发