| Time Limit: 1000MS | Memory Limit: 65536K | |
| Total Submissions: 8440 | Accepted: 5093 |
Description

Input
Output
Sample Input
2 8 10
Sample Output
1 15 9 11
==================================================================
这题就是Lowbit函数的使用,理解了Lowbit,这题就很容易了
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
#include <math.h>
#define MAxx 1000
int Lowbit(int x)
{
return x&(-x);
}
int main()
{
int i,j,n,m;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&m);
int cas=Lowbit(m);
printf("%d %d\n",m-cas+1,m+cas-1);
}
return 0;
}
poj 2309 BST(数学题),布布扣,bubuko.com
原文地址:http://www.cnblogs.com/ccccnzb/p/3837742.html