Cod sursa(job #397741)
Utilizator | Data | 17 februarie 2010 13:33:22 | |
---|---|---|---|
Problema | Factorial | Scor | 90 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include<fstream>
using namespace std;
int zero(int n)
{
int rez=0;
while (n)
{
rez+=n/5;
n/=5;
}
return rez;
}
int caut(int p)
{
int i,pas=1<<30;
for (i=0;pas;pas>>=1)
if (zero(i+pas)<p) i+=pas;
return i+1;
}
int main()
{
int p;
ifstream f("fact.in");
ofstream o("fact.out");
f>>p;
o<<caut(p);
return 0;
}