Cod sursa(job #2046649)
Utilizator | Data | 23 octombrie 2017 22:54:51 | |
---|---|---|---|
Problema | Factorial | Scor | 85 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main()
{
int p,n,x,nr,d;
fin>>p;
if(p==0){cout<<1;return 0;}
nr=0;
for(n=p*4;nr!=p;++n)
{
nr=0;x=n;d=5;
while(d<=n)
{
nr+=n/d;
d*=5;
}
}
fout<<n-1;
}