Cod sursa(job #36072)

Utilizator RobytzzaIonescu Robert Marius Robytzza Data 22 martie 2007 22:14:39
Problema Factorial Scor 5
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.35 kb
#include<fstream.h>
#include<string.h>
int main(){
ifstream fin("fact.in");
ofstream fout("fact.out");
long P,nr,x=0,N=0;
fin>>P;
if (P==0)
   fout<<1;
else
while (N!=P){
      x+=5;
      nr=x;
      while (nr%25==0){
	     nr/=25;
	     N+=2;}
      N++;
      }
if (P<0)
    x=-1;
fout<<x;
fin.close();
fout.close();
return 0;
}