ACM - 1的个数

Posted darkchii

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ACM - 1的个数相关的知识,希望对你有一定的参考价值。

  怒刷水题。。。

  AC代码:

#include <stdio.h>
int main()
{
    int x,t,count;
    scanf("%d",&t);
    while(t--)
    {
        count=0;
        scanf("%d",&x);
        for(; x!=0;x>>=1)
            count+=(x&1);
        printf("%d\n",count);
    }
	return 0;
}

  

以上是关于ACM - 1的个数的主要内容,如果未能解决你的问题,请参考以下文章