Cod sursa(job #71940)

Utilizator RobytzzaIonescu Robert Marius Robytzza Data 12 iulie 2007 11:31:30
Problema Factorial Scor 25
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.32 kb
#include<fstream.h>
long long N;
int main(){
ifstream fin("fact.in");
ofstream fout("fact.out");
fin>>N;
if (N==0)
fout<<1<<"\n";
else{
for (long long i=N*5;i>=5;i-=5){
long long x=5,y=5,nr=0;
while (x<=i){
  nr+=i/x;
  x*=y;}
if (nr==N){
   fout<<i<<"\n";
   break;}
}}
fin.close();
fout.close();
return 0;
}