Cod sursa(job #1108213)

Utilizator teodor440Teodor Tonghioiu teodor440 Data 15 februarie 2014 14:59:08
Problema Factorial Scor 5
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.47 kb
#include <iostream>
#include <fstream>
#include <math.h>

using namespace std;

int main()
{
  long x,n,i,p,s;
  ifstream f("fact.in");
  ofstream g("fact.out");
  f>>p;
  if(p==0){
    g<<1;
  }
  else{
    s=0;
    x=2;
    while(p>0){
        if(pow(5,x)>=i){
            p-=2;
            x++;
        }
        else{
            p--;
        }
    }
    if(p==-1){
        g<<-1;
    }
    else{
        g<<i;
    }
  }


  return 0;
}