标签:
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 9182 | Accepted: 5613 |
Description
Input
Output
Sample Input
2 8 10
Sample Output
1 15 9 11
Source
强大的lowbit,树状数组太神奇了
1 #include<cstdio> 2 #include<cstring> 3 #include<iostream> 4 using namespace std; 5 int lowbit(int k) 6 { 7 return k & (-k); 8 } 9 int main() 10 { 11 int t,x; 12 scanf("%d", &t); 13 while(t--) 14 { 15 scanf("%d", &x); 16 printf("%d %d\n",x - lowbit(x) + 1, x + lowbit(x) - 1); 17 } 18 return 0; 19 }
标签:
原文地址:http://www.cnblogs.com/zhaopAC/p/4984779.html