Follows 10019.c (Total 35 lines):

/* @JUDGE_ID:4461XX 10019 C */
/* A */
#include<stdio.h>

int count( int n )
{
	int total=0 ;

	while( n ){
		if( n%2 ) total++ ;
		n /= 2 ;
	}

	return total ;
}
int main( void )
{
	int n , m , b1 , b2 , i ;

	scanf( "%d" , &n ) ;
	for( ; n ; n-- ){
		scanf( "%d" , &m ) ;
		
		b1 = count( m ) ;
		for( b2=0 ; m ; ){
			b2 += count( m%10 ) ;
			m /= 10 ;
		}

		printf( "%d %d\n" , b1 , b2 ) ;
	}
	
	return 0 ;
}
/* @END_OF_SOURCE_CODE */

Back to statistics
Ya-Lin Huang (C)
huangyl@gmail.com