Pagini recente » Cod sursa (job #1999437) | Cod sursa (job #81447) | Cod sursa (job #1762438) | Cod sursa (job #948098) | Cod sursa (job #557789)
Cod sursa(job #557789)
#include<fstream.h>
int functie(int c)
{
int x=c;
while(2)
{
if(x%5==0)
{return x/5; break;}
x--;
}
}
int main()
{
ifstream fin("fact.in");
ofstream fout("fact.out");
int i,p,a=0,b=1000000000,c,y;
fin>>p;
while(2)
{
c=(a+b)/2;
y=functie(c);
if(y<p) a=c+1;
else
if(y>p) b=c-1;
else
if(y==p)
break;
}
if(p==0)
fout<<1;
else
fout<<c;
return 0;
}