| ||||||||||
| 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 | |||||||||
关键部分只算了1024+ 为什么16ms#include <stdio.h>
int a[10]={1,1,2,6,24,120,720,5040,40320,362880},b[410000],c[1026];
void main(){
long n,ic=0,jc,i;
c[0]=0;
for(i=0;i<=9;i++){
jc=ic;
while(jc+1){
c[++ic]=a[i]+c[jc--];
b[c[ic]]=10;
}
}
while(scanf("%d",&n)&&n>=0){
if(n>409115) puts("NO");
else if(b[n]==10) puts("YES");
else puts("NO");
}
}
//最后ic=1025 为什么要了16ms 郁闷咯
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator