Cod sursa(job #2344978)
Utilizator | Data | 15 februarie 2019 19:28:25 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.73 kb |
#include <iostream>
#include <fstream>
using namespace std;
ofstream fo("fact.out");
ifstream fi("fact.in");
int nrCif;
int fac(int x)
{
int cinci=0;
int sol=0;
for(int i=1; i<=x; i++)
{
int ci=i;
while(ci%5==0)
{
ci/=5;
cinci++;
}
}
sol=cinci;
return sol;
}
int main()
{
fi>>nrCif;
int poz=0;
if(x==0)
{
fo<<1;
return 0;
}
for(int i=25; i>=0; i--)
{
if( fac(poz+(1<<i))<nrCif)
{
poz+=(1<<i);
}
}
fo<<poz+1;
fi.close();
fo.close();
return 0;
}