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 fleago at 2007-03-07 20:27:05 on Problem 1316
#include<stdio.h>

#define N 10001
int d[N];

int dispose(int n)
{
	int sum =n;
	while(n/10>=0&&n)
		sum+=n%10,n/=10;
	return sum;
}

int main()
{
	int b=1,i=b;
//	FILE *fp;
//	fp=fopen("12.txt","w");
	while(1)
	{
		i=dispose(i);
		d[i]=1;
		if(i>=N)
		{
			b++;
			if(b>=N)
				break;
			i=b;
			while(d[i])
				i++;
		}
	}
	for(i=1;i<=N;i++)
		if(!d[i])
			printf("%d\n",i);//fprintf(fp,"%d\n",i);
	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