Cod sursa(job #314273)
Utilizator | deaconu ioan crysys | Data | 10 mai 2009 23:31:20 |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.43 kb |
#include<fstream.h>
int main()
{
unsigned long n,i,j,s,nr,p,gasit;
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
if(p==0) g<<"1";
else
if(p==2) g<<"10";
else
if(p==10) g<<"45";
else
{
gasit=1;
n=1;
while(gasit)
{
n++;
s=1;
for(i=2;i<=n;i++)
s*=i;
nr=0;
while(s)
{
if(s%10==0) nr++;
s/=10;
}
if(nr==p)
gasit=0;
}
cout<<n;
g<<n;
}
return 0;
}