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

Re:请大家指教我错在哪里。。郁闷中……

Posted by xuhanqiu at 2006-07-10 16:02:57 on Problem 2719
In Reply To:请大家指教我错在哪里。。郁闷中…… Posted by:chuizi_nudt at 2006-04-22 15:36:04
> #include <stdio.h>
> #include <math.h>
> #include <string.h>
> 
> char a[10];
> int res,b,i,la;
> 
> int main()
> {
> 	while(1)
> 	{
> 		scanf("%s",a);
> 		la=strlen(a);
> 		if(strcmp(a,"0")==0)
> 			break;
> 		res=0;
> 		for(i=la-1;i>=0;i--)
> 		{
> 			b=(int)(a[i]-'0');
> 			if(b>=4) b--;
> 			res+=b*(int)pow(9,la-i-1);
> 		}
> 		printf("%d\n",res);
> 	}
> 	return 0;
> }
> 
> 
> 

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