Cod sursa(job #441286)
Utilizator | Data | 12 aprilie 2010 20:56:30 | |
---|---|---|---|
Problema | Factorial | Scor | 60 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.32 kb |
#include<fstream.h>
int main ()
{
ifstream fcin("fact.in");
ofstream fcout("fact.out");
int p,zerouri,k,k2;
fcin>>p;
zerouri=0;
k=5;
while(zerouri<p)
{k2=k;
while(k2%5==0)
{zerouri++;
k2=k2/5;}
k=k+5;}
if(zerouri==p){if(k>5)fcout<<k-5;
else fcout<<1;}
else fcout<<-1;
return 0;
}