Cod sursa(job #798818)
Utilizator | Data | 17 octombrie 2012 13:15:51 | |
---|---|---|---|
Problema | Factorial | Scor | 90 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.43 kb |
#include <stdio.h>
int zero(int n){
int r;
r=0;
while(n>=5){
r+=n/5;
n/=5; }
return r; }
int caut(int p){
long long i,pas=1<<30;
i=0;
while(pas!=0){
if(zero(i+pas)<p)
i+=pas;
pas/=2; }
return i+1; }
int main(){
int p;
freopen("fact.in","r",stdin);
freopen("fact.out","w",stdout);
scanf("%d",&p);
printf("%d",caut(p));
}