Cod sursa(job #1731734)
Utilizator | Data | 19 iulie 2016 18:47:53 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.58 kb |
#include<iostream>
#include<fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int x=1,nr,p,ok,n;
int main()
{cin>>p;
while(ok==0){for(int i=1;i<=x;i++){n=i;
while(n%5==0){n=n/5;
nr++;
}
}
if(nr==p){ok=1;
cout<<x;
}
if(nr>p)cout<<"nu exista";
x++;
nr=0;
}
f.close();
g.close();
return 0;
}