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 dawei007 at 2010-05-12 09:32:22 on Problem 2453
int countbit(int n){int c;for(c=0;n;n>>=1)c+=n&1;return c;}

int main()
{
	int n;
	while(cin>>n && n)
	{
		int m=countbit(n);
		int i=n+1;
		while( countbit(i)!=m )
			i++;
		cout<<i<<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