标签:
#include <cstdio>
#include<algorithm>
using namespace std;
#define FOR(x,y,z) for(int (x)=(y);(x)<(z);++(x))
const int maxn = 100000 + 10;
int a[maxn];
int main(){
int t,n,maxAi,ans;
scanf("%d",&t);
while(t--){
scanf("%d",&n);
FOR(i,0,n) scanf("%d",a + i);
maxAi = a[0];
ans = a[0] - a[1];
FOR(i,1,n){
ans = max(maxAi - a[i],ans);
maxAi = max(maxAi,a[i]);
}
printf("%d\n",ans);
}
return 0;
}
[2016-03-19][UVA][11078][Open Credit System]
标签:
原文地址:http://www.cnblogs.com/qhy285571052/p/a014fd9394ef8526bf385b6a3ab68cbc.html