Cod sursa(job #2067357)
Utilizator | Data | 16 noiembrie 2017 11:48:25 | |
---|---|---|---|
Problema | Factorial | Scor | 90 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.36 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int nrz (int n)
{
int nr=0;
while (n>=5)
{
nr+=n/5;;
n/=5;
}
return nr;
}
int caut (int x)
{
int pas=1<<30,r=0;
while (pas!=0)
{
if (nrz(r+pas)<x)
r+=pas;
pas/=2;
}
return r+1;
}
int main()
{
int i,n;
f>>n;
g<<caut(n);
return 0;
}