import java.util.Arrays;
import java.util.Scanner;
// 1:无需package
// 2: 类名必须Main, 不可修改
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
//在此输入您的代码...
int N = scan.nextInt();
int[]arr = new int[N];
for (int i = 0; i < N; i++) {
arr[i] = scan.nextInt();
}
Arrays.sort(arr);
int temp = Integer.MAX_VALUE;
for (int i = 1; i < arr.length; i++) {
int a = arr[i]-arr[i-1];
temp = a<temp?a:temp;
}
if (temp==0) {
System.out.println(N);
return;
}else {
System.out.println((arr[N-1]-arr[0])/temp+1);
}
scan.close();
}
}
等差数列-
最新推荐文章于 2024-11-01 14:48:20 发布