| ||||||||||
| 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 | |||||||||
为什么WA阿#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator