最近看到这种题满脑子都是二分,贴一个二分答案的写法,时间复杂度是O(nlogn) #include<iostream> #include<algorithm> #include<math.h> #include<vector> typedef long long ll; using namespace std; const int N = 2e5 + 10; ll a[N]; int t, n, k; bool check(int x) { int b = 1, e = 1;//下标 while (e <n) { if (a[e] - a[...