Cod sursa(job #2212082)
Utilizator | Data | 13 iunie 2018 08:56:47 | |
---|---|---|---|
Problema | Factorial | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.41 kb |
# include <iostream>
# include <fstream>
using namespace std;
int main()
{
int n=5,p,cn;
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
if(p==0)g<<1;
else if(p==1)g<<5;
else
{--p;
while(p>0)
{
n+=5;
cn=n;
while(cn%5==0)
{
--p; cn/=5;
}
}
g<<n;
}
}