Follows 424.c (Total 37 lines):

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

void main(void)
{
	char a[101] ; int b[100] , c[103] , i , j , lenth ;
	for ( i=0 ; i<=102 ; i++ ) c[i]=0 ;
	gets (a) ;
	lenth=strlen(a) ;
	for ( i=0 ; i<=strlen(a)-1 ; i++ ) c[i]=a[lenth-i-1]-48 ;
	while(1)
	{
		gets (a) ;
		if ( *a=='0' ) break ;
		for ( i=0 ; i<=99 ; i++ ) b[i]=0 ;
		if ( strlen(a)>lenth ) lenth=strlen(a) ;
		for ( i=0 ; i<=strlen(a)-1 ; i++ ) b[i]=a[strlen(a)-i-1]-48 ;
		for ( i=0 ; i<lenth ; i++ )
		{
			c[i] += b[i] ;
			if ( c[i]>=10 )
			{
				c[i+1]+=(c[i]-c[i]%10)/10 ;
				c[i]=c[i]%10 ;
			}
		}
	}
	for ( j=102 ; j>=0 ; j-- )
		if ( c[j]!=0 )
		{
			for ( i=j ; i>=0 ; i-- ) printf( "%d" , c[i] ) ;
			break ;
		}
		printf("\n") ;
}

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