Cod sursa(job #1219040)

Utilizator yaquzoSimion Andrei yaquzo Data 13 august 2014 11:34:08
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.48 kb
#include <iostream>
#include<fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
 unsigned Max=100000000;

unsigned rezolvare(unsigned p)
{unsigned i;
   for(i=0;i<Max;i++)
   {if(i==p )
   return i*5;
   break;
      }
}


int main()

{unsigned p,N;
    f>>p;
    if(p==0)
    N=1;
    if(p>5)
    N=rezolvare(p)-5;
    if(p<5)
    N=rezolvare(p);
    if(p==5)
    N=-1;
    g<<N;
    f.close();
    g.close();
    return 0;
}