| ||||||||||
| 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 | |||||||||
菜鸟ACMer 99题纪念…水过…#include <iostream>
#include <cstdio>
using namespace std;
const int fac[10]={1,1,2,6,24,120,720,5040,40320,362880};
int main()
{
int N;
while(cin>>N)
{
if(N<0)
break;
if(!N)
{
cout<<"NO"<<endl;
continue;
}
for(int j=9;j>=0;j--)
{
if(fac[j]<=N)
N-=fac[j];
}
if(!N)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator