此题,运用树状数组的特性(discuss里谈的)。
对此表示不理解。等研究了树状数组再谈!
#include <iostream>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
int tmp = n & -n;
int ans1 = n-tmp + 1;
int ans2 = n+tmp - 1;
cout << ans1 << ' ' << ans2 << endl;
}
return 0;
}