Cod sursa(job #2544493)
Utilizator | Data | 12 februarie 2020 09:51:01 | |
---|---|---|---|
Problema | Factorial | Scor | 20 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int p,k2,k5,n=1,minim=0,cop;
int main()
{
fin>>p;
while(1)
{
cop=n;
if(n%2==0)while(cop%2==0){k2++;cop/=2;}
if(n%5==0)while(cop%5==0){k5++;cop/=5;}
if(k2<k5)minim=k2;
else minim=k5;
if(minim==p)break;
++n;
}
fout<<n;
return 0;
}