Cod sursa(job #1546560)
Utilizator | Data | 8 decembrie 2015 11:00:36 | |
---|---|---|---|
Problema | Factorial | Scor | 15 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.41 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int grad5(int n)
{
int m;
m=0;
while (n>=5)
{
if (n%5==0) m++;
n/=5;
}
return m;
}
int main()
{ long long x,y,z;
fin>>x;
y=5;
z=0;
while (z<x)
{
z+=grad5(y);
y+=5;
}
if (z==x) fout<<y-5; else fout<<"-1";
return 0;
}