Cod sursa(job #1779334)
Utilizator | Data | 15 octombrie 2016 09:36:27 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.48 kb |
#include <iostream>
#include <fstream>
using namespace std;
long long n,nr=0,x,y;
int main()
{
ifstream f("fact.in");
ofstream g("fact.out");
f>>n;
x=n*5;
while (nr!=n)
{
nr=0;
for (int i=5;i<=x;i+=5)
{
y=i;
while (y%5==0)
{
nr++;
y=y/5;
}
}
if (nr>n) x=x-5;
else if (nr<n) x=x+5;
}
g<<x;
return 0;
}