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

关键部分只算了1024+ 为什么16ms

Posted by qqmsyz520 at 2008-09-02 20:39:40 on Problem 1775
#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:
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