| ||||||||||
| 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 | |||||||||
Re:推荐代码In Reply To:Re:推荐代码 Posted by:bhq at 2009-04-25 11:09:38 #include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main()
{
int x,n,k,t;
cin>>n;
while(n--)
{
cin>>x;
t=x;
k=0;
while((t&0x1)==0)
{
t>>=1;
k++;
}
t=1<<k;
cout<<(x-t+1)<<" "<<(x+t-1)<<endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator