您的位置:首页 > 其它

POJ2309BST【树状数组的理解】

2014-09-24 21:38 162 查看
大意:

对于这个树

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

int lowbit(int x) {
return x & ( - x );
}

int main() {
int n;
int t;
scanf("%d",&t);
while(t--) {
scanf("%d",&n);
int n1 = n - lowbit(n);
printf("%d", n1 + 1);
int n2 = n + lowbit(n);
printf(" %d\n", n2 - 1);
}
}


View Code
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: