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

Re:Why wrong?实在找不出了

Posted by dongshanluo at 2006-08-13 10:10:34 on Problem 1775
In Reply To:Why wrong?实在找不出了 Posted by:dongshanluo at 2006-08-13 10:10:22
#include<stdio.h>
void main()
{
	int i;
	long int n,t[10];
	t[1]=1;
	for(i=2;i<10;i++)t[i]=i*t[i-1];
	while(1)
	{
		scanf("%ld",&n);
		if(n<0)break;
		if(n==0)printf("NO\n");
		else
		{
			for(i=9;i>0&&n>0;i--)
			{	
				if(n>=t[i])n-=t[i];
			}
			if(n==0)printf("YES\n");
			else printf("NO\n");
		}
	}
}

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