Cod sursa(job #928865)

Utilizator TheFFOFratila Florin Ovidiu TheFFO Data 26 martie 2013 19:02:28
Problema Factorial Scor 15
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.42 kb
#include <cstdio>
using namespace std;
int main()
{
    freopen("fact.in","r",stdin);
    freopen("fact.out","w",stdout);
    int p;
    scanf("%d",&p);
    if(p==0)
        printf("1");
    else
    {
        int i;
        for(i=1;i<=p;++i)
            if(!(i%5))
                ++i;
        --i;
        if(p==i)
            printf("%d",5*i);
        else
            printf("-1");
    }
    return 0;
}