| ||||||||||
| 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 | |||||||||
大家帮忙看看这题2309怎么会RE啊!!让人很郁闷的#include <iostream>
using namespace std;
int main()
{
long int time, root, cen;
long int min, max, tmp;
cin>>time;
while(time>0)
{
cin>>root;
cen=2;
while((root-cen)%(cen*2)!=0)
{
cen=cen*2;
}
if((root-cen)%(cen*2)==0)// 其左右分别是+/- cen/2
{
//tmp;
max=root;
min=root;
for(tmp=cen/2;tmp>1;tmp/=2)
{
max+=tmp;
min-=tmp;
}
cout<<min-1<<" "<<max+1<<endl;
}
time--;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator