2581. 0 and 1

10185101141

AC

include

include

int main()
{
int n,N;
scanf(“%d”,&N);
for(n=0;n<N;n++){
int x;
int n=0,m=0;
int d;
scanf(“%d”,&x);
while(1){
d=x%2;
if(d==1){
n++;
}
x=(x-d)/2;
if(d==0)
m++;
if(x==0)break;
}
printf(“%d %d\n”,m,n);
}
return 0;
}

你当前正在回复 博客/题目
存在问题!