Cod sursa(job #920859)

Utilizator TheFFOFratila Florin Ovidiu TheFFO Data 20 martie 2013 17:36:18
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.45 kb
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <math.h>
using namespace std;
long long result=25;
int main()
{
    freopen("fact.in","r",stdin);
    //freopen("fact.out","w",stdout);
    int p,i;
    scanf("%d",&p);
    if(!((p/5)%5)&&p>4||p==5)
        printf("-1");
    else
    {
        result=5*p;
        i=p/5;
        if(!(p%5))
            i--;
        result=i*5;
        cout<<result;
    }
    return 0;
}