Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

仅供参考

Posted by handle2 at 2009-08-07 12:09:31 on Problem 2309
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator