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

哪错了,各位大哥 :小妹求救!!!!!!!!!!也是九进制呀

Posted by y05zyg at 2006-08-15 17:25:18 on Problem 2719
# include<iostream.h>
# include<math.h>
# include<string.h>
int main ()
{
	char*a=new char[10]; 
	while(cin>>a)
	{
		double M=0;
		if(a[0]=='0')break;
		int LA=strlen(a);
		int La=LA-1;
		for(int i=0;i<LA;i++)
		{
			cout<<a[i];
			if(a[i]<'4')
			{
				M+=(a[i]-'0')*pow(9,La--);				
			}			
			else M+=(a[i]-'0'-1)*pow(9,La--);
		}
		cout<<":"<<' '<<M<<endl;
	}
	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