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

水平不高,还望大神们解释一下为什么数组定义成10000不行,15535才行,和int有关?

Posted by liuyuxue at 2015-10-20 15:46:03 on Problem 1316
#include<stdio.h>
int main()
{
	int i,j=0;
	int sum,n;
	int a[15535]={0};
	for(i=1;i<10000;i++)
	{
		sum=i;
		n=i;
		while(n)
		{
           sum=sum+n%10;
		   n=n/10;
		}
		a[sum]=1;
	} 
	for(i=1;i<10000;i++)
	{
		if(a[i]==0)
		printf("%d\n",i);
	}
	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