| ||||||||||
| 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 | |||||||||
暴搜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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator