Pagini recente » Cod sursa (job #2938220) | Cod sursa (job #2671575) | Cod sursa (job #2860703) | Cod sursa (job #2483412) | Cod sursa (job #150259)
Cod sursa(job #150259)
#include<stdio.h>
#include<iostream.h>
long getz(long x){
long a=(x/5+x/25);
return a;
}
int main(void){
long p,i,n=0;
FILE *in=fopen("fact.in","rt"),*out=fopen("fact.out","w+");
fscanf(in,"%ld",&p);
long l=0,r=100000000,m=(l+r)/2;
while(l<r){
m=(l+r)/2;
if(getz(m)==p) {n=m;break;}
else if (getz(m)<p) l=m;
else if (getz(m)>p) r=m;
}
// if(i==100000) fprintf(out,"%ld",i);
fprintf(out,"%ld",n-1);
}