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

为什么WA阿

Posted by bnugong1 at 2008-03-28 14:06:56 on Problem 1775
#include<stdio.h>
int a[15];
void di(int n)
{
	int t,i;
	if(n==0){
		printf("NO\n");
		return;
	}
	for(i=10;i>=0;i--)if(a[i]<=n)break;
	t=i;
	while(n>0)
	{
		n-=a[t];
		t--;
		if(t<0)break;
	}
	if(n==0)printf("YES\n");
	else printf("NO\n");
	return;
}
int main()
{
	int n,i;
	a[0]=1;
	for(i=1;i<=10;i++)a[i]=a[i-1]*i;
	scanf("%d",&n);
	while(n>=0)
	{
		di(n);
		scanf("%d",&n);
	}
	return 0;
}

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