16-09-01(最大波动)

	import java.util.*;
	public class csp_16_09_01{
    
    
	public static void main(String[] args){
    
    
	Scanner in = new Scanner(System.in);
	int n = in.nextInt();
	int[] a = new int[n];
	int result = 0;
	for(int i =0;i<n;i++){
    
    
	 a[i] = in.nextInt();
	if(i>0){
    
    
	int t = Math.abs(a[i]-a[i-1]);
	if(result < t){
    
    
	result = t;
	}
	}//if

	}//for
in.close();
	System.out.print(result);
	}//main
	}//Main

猜你喜欢

转载自blog.csdn.net/qq_51985653/article/details/121501806