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 |
仅供参考#include"iostream" using namespace std; int main() { int n,num,i,x,min,max,temp,r; cin>>n; while(n--) { cin>>x; num=0; r=x; temp=r&0x01; while(temp==0){num++;r>>=1;temp=r&0x01;} i=1<<num; min=x+1-i; max=x-1+i; cout<<min<<" "<<max<<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