Cod sursa(job #1895043)

Utilizator eduardandrei20Nechifor Eduard Andrei eduardandrei20 Data 27 februarie 2017 19:11:21
Problema Factorial Scor 15
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.32 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main()
{int n,p=5,nr=0;;
f>>n;
if(n==0)g<<1;
else {while(nr!=n)
 {nr=0;
     nr+=p/5;
nr+=p/25;
nr+=p/125;
nr+=p/625;
nr+=p/3125;
nr+=p/15625;
nr+=p/15625*5;
p+=5;
}
g<<p-5;}

    return 0;
}