算法

条件:

a[j] + a[j+1] < x*2

int findClosestPoint(int x,int a [])
{
    int res = 0;
    int j = 0;
    while(j<a.length-1 && a[j]+a[j+1]<x*2) j++;
    res = Math.max(res,Math.abs(x-a[j]));
    return res;
}
原文地址:https://www.cnblogs.com/qlky/p/7744035.html