Cod sursa(job #805364)

Utilizator bondoralexandru bondor bondor Data 31 octombrie 2012 12:06:12
Problema Factorial Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.46 kb
#include<stdio.h>
int div25(int a){
    int r=0;
    while(a%5==0){
        r++;
        a/=5;
    }
    return r;
}
int main(){
    long p,pp,s,i;
    freopen("fact.in","r",stdin);
    freopen("fact.out","w",stdout);
    scanf("%ld",&p);
    pp=0;
    s=0;
    if(p==0)printf("1");
    for(i=5;i<=100000000;i+=5){
        s+=div25(i);
        if(s==p){
            printf("%ld",i);
            i=1000000000;
        }
    }
    return 0;
}