Cod sursa(job #2071650)
| Utilizator | Data | 20 noiembrie 2017 20:55:17 | |
|---|---|---|---|
| Problema | Factorial | Scor | 15 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.5 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
long p,pas,r,l;
int zero(long n)
{
int nrz=0;
while(n>=5)
{
nrz+=(n/=5);
}
return nrz;
}
int caut_bin(long x)
{
pas=1<<l;
r=0;
while(pas!=0)
{
if(zero(r+pas)<x)
{
r+=pas;
}
pas/=2;
}
r++;
return r;
}
int main()
{
f>>p;
l=16;
g<<caut_bin(p);
return 0;
}
