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 |
你的算法真的很好,我改动了一下通过了,下面是代码In Reply To:Re:我自己运行可以,怎么提交就是runtime errer Posted by:johnlin55 at 2006-08-15 12:46:12 > 原来不用out[]来记录输出,直接输出就行了。 > out[1000]太小了 #include<iostream> using namespace std; int main() { long int a[10]={362880,40320,5040,720,120,24,6,2,1,1}; int in; cin>>in; while(in>=0) { if(in==0)cout<<"NO"<<endl; else { for(int i=0;i<10;i++) if(in>=a[i])in-=a[i]; if(in==0)cout<<"YES"<<endl; else cout<<"NO"<<endl; } cin>>in; } system("pause"); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator