Cod sursa(job #2188468)
Utilizator | Data | 27 martie 2018 10:13:05 | |
---|---|---|---|
Problema | Factorial | Scor | 35 |
Compilator | cpp | Status | done |
Runda | bpc9 | Marime | 0.5 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream fin("fact.in");
ofstream fout("fact.out");
int p;
fin>>p;
if(p==0)
fout<<1;
else if(p==1)
fout<<0;
else
{
int x=0;
int k=0;
while(k<=p)
{
x=x+5;
int cx=x;
while(cx%5==0)
{
++k;
cx=cx/5;
}
}
fout<<x-5;
}
}