Cod sursa(job #2418529)
Utilizator | Data | 5 mai 2019 13:35:00 | |
---|---|---|---|
Problema | Factorial | Scor | 25 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.45 kb |
#include <fstream>
#include <cmath>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
int p,x=5,y,zerouri;
int main()
{
in>>p;
if (!p)
out<<1<<"\n";
else
{
while (1)
{
y=x;
while (x%5==0) x=x/5,zerouri++;
if (zerouri>=p)
{
out<<y<<"\n";
return 0;
}
x=y+5;
}
}
}