Cod sursa(job #581700)
Utilizator | Data | 14 aprilie 2011 15:14:06 | |
---|---|---|---|
Problema | Factorial | Scor | 50 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include<fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main()
{
int i,p,s=0,aux,gasit=0;
fin>>p;
if(p==0)
fout<<'1';
else
for(i=5;!gasit;i+=5)
{
aux=i;
while(aux%5==0)
{
s++;
aux/=5;
}
if(s==p)
{
fout<<i<<'\n';
gasit=1;
}
}
fin.close();
fout.close();
return 0;
}