Follows 575.c (Total 19 lines):

/* @JUDGE_ID:4461XX 575 C */
/* A */
#include <stdio.h>
#include <string.h>
#include <math.h>
void main ( void )
{
	char a[80] ; unsigned long i , number , num[80] ;
	while( gets( a ) )
	{
		if( *a=='0' ) break ;
		for( i=0 ; i<strlen( a ) ; i++ )
			num[strlen( a )-i-1] = a[i] - '0' ;
		number = (unsigned long) 0 ;
		for( i=0 ; i<strlen( a ) ; i++ )
			number += num[i] * ( (unsigned long) pow( 2 , i+1 ) - (unsigned long) 1 ) ;
		printf( "%lu\n" , number ) ;
	}
}

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