Cod sursa(job #1252097)
| Utilizator | Data | 30 octombrie 2014 13:20:11 | |
|---|---|---|---|
| Problema | Factorial | Scor | 25 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.49 kb |
#include <iostream>
#include <fstream>
using namespace std;
int p;
int zero (int n)
{
int rez;
rez=0;
while(n>=5)
{
rez+=n/5;
n/=5;
}
return rez;
}
int main()
{
int n, min, i=0;
ifstream in("fact.in");
ofstream out("fact.out");
in>>p;
in.close();
int pas = 1<<24;
while (pas!=0)
{
if(zero(pas+i)<p)
i+=pas;
pas>>=1;
}
out<<i+1;
out.close();
return 0;
}
