for (int i = 1; i <= n; i++) a[i] = s[i + 1] - s[i]; a[0] = a[n] = inf; n--;
此题所求为最小值,故将边界值设为 +∞+ \infty+∞。