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

why WA

Posted by yeyin at 2004-05-14 12:48:31 on Problem 1316
#include <iostream.h>
#include <memory.h>
#include <math.h>
int number[10001];
int size (int a)
{
	int s=int (log(a)/log(10))+1;
	int g=0;
	int result=0;
	for (g=0;g<s;g++)
	{
		result=result+a%10;
		a=a/10;


	}
	return result;
}

int main()
{
	int a=1;
     
	memset (number,0,sizeof (number));

	while (a<=10000)
	{
		number[a+size(a)]=1;
		a++;
	}
	for (a=1;a<=10000;a++)
	{
		if (number[a]==0)
			cout<<a<<endl;
	}
}

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