Pagini recente » Monitorul de evaluare | Cod sursa (job #3356091) | Cod sursa (job #2862947) | Cod sursa (job #3353069) | 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;
}