| ||||||||||
| 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"stdio.h"
#include"math.h"
int main()
{ int m,x,k,p,q,min,max;
scanf("%d",&m);
while(m--)
{ scanf("%d",&x);
if(x%2==1)
{ min=x; max=x;
}
else
{ p=1;
for(k=1;k<31;k++)
{ p=p*2; q=p*2;
if(x%p==0&&x%q!=0)
break;
}
min=x-p+1;
max=x+p-1;
}
printf("%d %d\n",min,max);
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator