Cod sursa(job #30899)
| Utilizator | Data | 15 martie 2007 11:44:08 | |
|---|---|---|---|
| Problema | Factorial | Scor | 25 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.53 kb |
#include<fstream>
#include<math.h>
using namespace std;
unsigned long p,n,e,i,d,c;
void citire();
void prel();
void afis();
void citire()
{ ifstream fin("fact.in");
fin>>p;
fin.close();
}
void prel()
{ if(p==0) n=1;
c=1;
for(i=1;i<=c;i++)
{ d=i;
while(d%5==0)
{ d/=5;
e++;
}
if(e==p)
{ n=i;
break;
}
c++;
}
}
void afis()
{ ofstream fout("fact.out");
fout<<n;
fout.close();
}
int main()
{ citire();
prel();
afis();
return 0;
}
