10125 - Sumsets Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_problem&problem=1066 Given S, a set of integers, find the largest d such that a + b + c = d where a, b, c, and d are distinct elements of S
复制代码 代码如下: public class HalfSearch { public static int halfSearch(int a[], int x) { int mid, left, right; left = 0; right = a.length - 1; mid = (left + right) / 2; while (a[mid] != x) { if (x > a[mid]) { left = mid + 1; } else if (x <