| ||||||||||
| 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>
#include <cmath>
using namespace std;
int main()
{
int n,m;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>m;
int i=0;
int sum=0;
for(int p=2;m%p==0;p=p*2)
i++;
for(int j=0;j<=i-1;j++)
{
sum +=pow(2,j);
}
cout<<m-sum<<" "<<m+sum<<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