Cod sursa(job #2779693)
Utilizator | Data | 4 octombrie 2021 19:04:35 | |
---|---|---|---|
Problema | Factorial | Scor | 60 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 kb |
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int p,k,s,x,o;
int main()
{
f>>x;
while((k+p)<x)
{
k++;
o=k;
while(o%5==0)
{
o/=5;
p++;
}
}
if(k+p==x)
g<<k*5;
else
g<<"-1";
}