标签:
#include <iostream>
using namespace std;
int Grail(int x)
{
int N=0;
while(x)
{
x=x&(x-1);
N++;
}
return N;
}
int main()
{
cout<<Grail(7)<<endl;
//0111
//0110
//0101
//0100
//0100
//0011
return 0;
}标签:
原文地址:http://blog.csdn.net/liuhuiyan_2014/article/details/45037161