Cod sursa(job #2865326)
Utilizator | Data | 8 martie 2022 18:43:34 | |
---|---|---|---|
Problema | Factorial | Scor | 20 |
Compilator | cpp-64 | 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 n=1,p,nr=0,cn,k=0;
fin>>p;
while(nr<p){
cn=n;
k=0;
while(cn%5==0){
k++;
cn=cn/5;
}
nr=nr+k;
//cout<<"testing "<<n<<"\n";
//cout<<k<<" "<<nr<<"\n";
n++;
}
fout<<n-1;
return 0;
}