二分查找
#include<cstdio> #include<algorithm> using namespace std; inline void in(int &x){ char c;x=0; do c=getchar(); while (c<'0'||c>'9'); while (c>='0'&&c<='9')x=x*10+c-48,c=getchar(); } void work(){ } inline int low_bound(int a[],int len,int x) { int l = 0, r = len-1, mid; while (l<r) { mid = (l+r)>>1; if (a[mid]<x)l = mid+1; else r = mid; } return l; } inline int up_bound(int a[],int len,int x) { int l = 0, r = len-1, mid; while (l<r) { mid = (l+r)>>1; if (a[mid]<=x)l = mid+1; else r = mid; } return l; } int main(){ int t;scanf("%d",&t); while(t--){ work(); } return 0; }