BST

#include <iostream>
using namespace std;
long lowbit(long x)
{
    return x&-x;
}
int main()
{
    long n,x;
    cin>>n;
    while(n--)
    {
        cin>>x;
        cout<<x-lowbit(x)+1<<" "<<x+lowbit(x)-1<<endl;
    }
    return 0;
}

你可能感兴趣的:(BST)