二分模板

wyh15 Minecraft 2024-04-11 19:43:36 2024-04-11 19:45:43 8
    int l = 0,r = n-1,mid;

    while(l<=r){

        mid = (l+r)/2;

        if(a[mid]==m){

            cout<</*输出*/;

            return 0;

        }

        else if(a[mid]>m){

            r = mid -1;

        }

        else l = mid + 1;

        }
    cout<</*输出*/;
{{ vote && vote.total.up }}