Cod sursa(job #1182233)
Utilizator | Data | 5 mai 2014 11:51:04 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int nr5(int x)
{
int sum=0;
while (x)
{
sum+=x/5;
x/=5;
}
return sum;
}
#define cout g
int main()
{
f>>p;
s=1;d=100000000;
while (s<=d)
{
m=(s+d)/2;
if(nr5(m)==p) {
cout<<m<<'\n';
return 0;
}
}
return 0;
}