Cod sursa(job #1509602)
Utilizator | Data | 24 octombrie 2015 09:10:38 | |
---|---|---|---|
Problema | Factorial | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.4 kb |
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main()
{
int P,i,j;
fin>>P;
i=0;
if(P==0)fout<<1;
else
{
while(P!=0)
{
i=i+5;
j=i;
P--;
j=j/5;
while(j%5==0)
{
j=j/5;
P--;
}
}
fout<<i;
}
return 0;
}