Cod sursa(job #2484976)
Utilizator | Data | 31 octombrie 2019 20:30:49 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.49 kb |
#include <iostream>
using namespace std;
int main()
{int n,p,i,aux,x2,x5;
cin>>p;n=1;
while(p!=0) {x5=0;x2=0;
for(i=1;i<=n;i++) {aux=i;
if(aux%2==0) while(aux%2==0) {aux/=2;x2++;}
if(aux%5==0) while(aux%5==0) {aux/=5;x5++;}
}
n++;
if(x2<x5) {if(x2==p) {p=0;n--;}}
else {if(x5==p) {p=0;n--;}}
}
cout<<n;
return 0;
}