解法一:若二进制末尾为1,则除以2余1;int count(int a){ int num=0; while(a) { if(a%2==1) ++num; a=a/2; } return num;}解法二:使用移位操作相... Read More
posted @ 2014-08-09 20:41 chengcy Views(145) Comments(0) Diggs(0)