Cod sursa(job #1122807)

Utilizator VandheerManPopescu Alin VandheerMan Data 25 februarie 2014 20:35:16
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.53 kb
#include <fstream>
#include <iostream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");


int main()
{   unsigned int p;
     freopen("fact.in","r",stdin);
     scanf("%d",&p);
     freopen("fact.out","w",stdout);

     switch (p)
                {
                 case 0: printf("%d\n",1);
                   return 0;
                 case 5: printf ("%d\n",-1);
                         return 0;
                }
     if (p<5) printf("%d\n",p*5);
     else printf("%d\n",(p-1)*5);
    return 0;
}