Cod sursa(job #2471228)
| Utilizator | Data | 10 octombrie 2019 16:56:42 | |
|---|---|---|---|
| Problema | Factorial | Scor | 10 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <iostream>
#include <fstream>
using namespace std;
int verf(int n)
{
int rez=0;
while(n)
{
rez=rez+n/5;
n=n/5;
}
return rez;
}
int main()
{
ifstream f("fact.in");
ofstream g("fact.out");
int p,i,gasit=0,nr=1,x;
f>>p;
while(gasit==0)
{
nr++;
if(verf(nr)==p)
{
x=nr;
gasit=1;
}
}
if(gasit==1)
g<<x;
else
g<<-1;
return 0;
}
