Cod sursa(job #2326320)
Utilizator | Data | 23 ianuarie 2019 13:52:45 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp-64 | Status | done |
Runda | simulare_preoli | Marime | 0.39 kb |
#include <iostream>
#include <fstream>
#include <math.h>
#define X 10000
using namespace std;
int main(){
int n,p,k=1,l,pp,o=0;
ifstream fin("fact.in");
ofstream fout("fact.out");
fin>>p;
for (n=1; o<p; ++n){
k*=n;
if (k%10==0){
++o;
k/=10;
}
}
if (p<=0)
cout<<"-1";
else fout<<n-1;
}