| ||||||||||
| 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 | |||||||||
Re:Why wrong?实在找不出了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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator