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 |
Re:我自己运行可以,怎么提交就是runtime errerIn Reply To:我自己运行可以,怎么提交就是runtime errer Posted by:johnlin55 at 2006-08-14 13:28:16 > #include<iostream> > using namespace std; > void main() > { > long int a[10]={362880,40320,5040,720,120,24,6,2,1,1}; > int in,i,out[1000],n=0; > cin>>in; > while(in>=0) > { > if(in==0)out[n]=0; > else > { > for(i=0;i<10;i++) > if(in>=a[i])in=in-a[i]; > if(in==0)out[n]=1; > else out[n]=0; > } > n++; > cin>>in; > } > for(i=0;i<n;i++) > if(out[i])cout<<"YES\n"; > else cout<<"NO\n"; > } 原来不用out[]来记录输出,直接输出就行了。 out[1000]太小了 Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator