Cod sursa(job #2780061)
| Utilizator | Data | 5 octombrie 2021 21:06:19 | |
|---|---|---|---|
| Problema | Factorial | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.52 kb |
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int sol1(int x)
{
int sol,rez=0,cont=0;
while(x>rez)
{
cont++;
sol=(x/5)*4+cont;
rez=sol;
while(sol/5)
{
rez+=sol/5;
sol/=5;
}
}
if(x==rez)
if(x==0)
sol=1;
else
sol=((x/5)*4+cont)*5;
else
sol=-1;
return sol;
}
int main()
{
int x;
f>>x;
g<<sol1(x);
}
