Cod sursa(job #1313141)

Utilizator czlateaZlatea Cezar czlatea Data 10 ianuarie 2015 12:38:25
Problema Factorial Scor 45
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
#include <cstdio>
using namespace std;
int x=0;
void d(int n)
{
    while(n%5==0)
    {
        n/=5;
    x++;
    }
}
int main()
{
    freopen("fact.in","r",stdin);
    freopen("fact.out","w",stdout);
    int n,k,l;
    scanf("%d",&k);

    for(n=5;x<k;n+=5)
    {l=n;d(l);}
    if(k==x)
        printf("%d",n-5);
    else
        printf("-1");
    return 0;
}