UVA 11078 Open Credit System

题目描述:http://uva.onlinejudge.org/external/110/11078.html


/*
 * 11078.cc
 *
 *  Created on: Jan 22, 2013
 *      Author: guixl
 */

#include <stdio.h>

int max(int a, int b) {
	return a > b ? a : b;
}

int main(int argc, char** argv) {
	int T;
	scanf("%d", &T);
	while(T-->0) {
		int n,max_i, max_value = -300000, value_j;
		scanf("%d%d", &n, &max_i);
		for (int i=1; i<n; i++) {
			scanf("%d", &value_j);
			max_value = max(max_value, max_i-value_j);
			max_i = max(max_i, value_j);
		}
		printf("%d\n", max_value);
	}
	return 0;
}





你可能感兴趣的:(UVA 11078 Open Credit System)