Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
水平不高,还望大神们解释一下为什么数组定义成10000不行,15535才行,和int有关?#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator