Mai intai trebuie sa te autentifici.
Cod sursa(job #303669)
Utilizator | Data | 10 aprilie 2009 09:56:24 | |
---|---|---|---|
Problema | Factorial | Scor | 25 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.31 kb |
#include<math.h>
#include<fstream.h>
ifstream fin("fact.in");ofstream fout("fact.out");
long nr,s,p,k,i,j;
int main()
{
fin>>k;
if(k==0)
fout<<1;
else
{
do
{
s=0;
p=5;
while(nr/p)
{
s=s+nr/p;
p=p*5;
}
nr=nr+5;
}
while(s<k);
fout<<nr-5;;
}
return 0;
}