| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
其实就是树状数组的lowbit。10行。In Reply To:Re:有个想法 Posted by:2008011292 at 2010-02-22 22:38:53 #include <cstdio>
using namespace std;
int main() {
long long x;
int tcase;
scanf("%d",&tcase);
while (tcase--) {
scanf("%lld",&x);
printf("%lld %lld\n",x-(x&(-x))+1,x+(x&(-x))-1);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator