Cod sursa(job #2609290)
Utilizator | Data | 2 mai 2020 13:23:22 | |
---|---|---|---|
Problema | Factorial | Scor | 25 |
Compilator | cpp-64 | Status | done |
Runda | igorj_mentorat1 | Marime | 0.58 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
long long cer,n,x,cinci;
void fcinci()
{
while(x % 5 == 0)
{
++ cinci;
x /= 5;
}
}
int main()
{
f >> cer;
if(!cer)
{
g << 1;
return 0;
}
n = 1;
while(1)
{
x = n;
fcinci();
if(cinci == cer)
{
g << n;
return 0;
}
if(cinci > cer)
{
g << -1;
return 0;
}
++ n;
}
}