Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

who can help me,I am a newhand!

Posted by kuangwenkui at 2007-06-20 20:47:05 on Problem 2719
#include<stdio.h>
#include<string.h>
#include<math.h>
main()
{char a[10000];
int i,j,len;
long sum;
sum=0;
     for(i=0; ;i++)
	 { scanf("%s",a);
	     if(a[0]=='0')
		break;
	   len=strlen(a);
	    for(j=0;j<len;j++)
	       {sum=sum+(int)(a[i]-'0')*(int)(pow(9,len-1-j));
	     if(a[j]>'4')
		sum=sum-pow(9,len-1-j);

		}

	     printf("%s: %ld\n",a,sum);
	  }
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator