Cod sursa(job #898205)
Utilizator | Data | 28 februarie 2013 08:52:42 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int n,kapcs=0,i=3,fact=2,j,szl=2;
long long x;
int megoldas()
{
while(kapcs==0)
{ szl++;
fact*=i;
i++;
if(fact%x==0)
return szl;
}
}
int main()
{
f>>n;
x=1;
for(j=1;j<=n;j++)
x*=10;
if(n==0)
g<<1;
else
{
megoldas();
g<<szl;
}
return 0;
}