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 happyme at 2006-08-01 22:49:10 on Problem 2719
#include<iostream>
using namespace std;

void ChangTo(int num)
{
	int i=num;
	int j;
	int n=0;
    int lastnum=0;
	int f;

	while (i)
	{    
		j=i%10;

		if (j>4)
		{
			j-=1;
		}

    	for(int k=0; k<n; k++)
		{
			j*=9;
		}

		lastnum+=j;

		i/=10;

		n++;
}

	cout<<num<<": "<<lastnum<<endl;
}


int main()
{
	int num;

	while(cin>>num)
	{
		if (!num)
		{
			break;
		}

        ChangTo(num);
	}
return 1;
}

   

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