Pagini recente » Cod sursa (job #1237084) | Cod sursa (job #2403234) | Diferente pentru problema/oneouts intre reviziile 7 si 10 | Cod sursa (job #1471984) | Cod sursa (job #2078456)
#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
int nr_0 (int x)
{
int a=5,p=0;
while(a<=x)
{
p+=x/a;
a*=5;
}
return p;
}
int main()
{
ifstream fin("fact.in") ;
ofstream fout("fact.out");
int P,pas=1<<32,r=0;
fin>>P;
while(pas!=0)
{
if(nr_0(r+pas)<P)
r+=pas;
pas/=2;
}
fout<<r+1;
return 0;
}