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 lyc5305562 at 2008-12-01 01:08:29 on Problem 1316
#include<iostream>
using namespace std;

int main()
{
	int a[10001] = {0};
	int num = 0;
	int n , m;
		int i , j = 0;
		for(i = 1 ; i < 10001; i++)
		{
			num = i;
			if(!a[i])
				cout<<i<<endl;
			
			n = i;	
			while( n )
			{
				m = n % 10;
				num += m;
				n /= 10;
			}
			if(num < 10001)
				a[num] = 1;
		}
			
	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