Cod sursa(job #474468)
| Utilizator | Data | 3 august 2010 21:16:30 | |
|---|---|---|---|
| Problema | Factorial | Scor | 5 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.35 kb |
#include<iostream.h>
#include<fstream.h>
ifstream f("fact.in");
ofstream g("fact.out");
long x=1,v;
int p,i,z;
void fact(int n)
{int i;unsigned long y=1;
for(i=1;i<=n;i++)y*=i;
v=y;
}
int main()
{
f>>p;
if(p==0)g<<1;
else
for(i=1;i<=p;i++)x*=10;
z=0;
fact(z);
while(v%x!=0)
{
z++;
fact(z);
}
g<<z;
}
