Pagini recente » Cod sursa (job #2009671) | Cod sursa (job #1158096) | Cod sursa (job #309618) | Cod sursa (job #2283448) | Cod sursa (job #541285)
Cod sursa(job #541285)
#include <fstream>
using namespace std;
int zerouri(int n) {
int suma=0,x;
x=n;
while(n) {
suma+=n%5;
n/=5;
}
return (x-suma)/4;
}
int main() {
int n,x,z;
bool gasit=false;
ifstream f("fact.in");
f>>n;
f.close();
x=n*4;
ofstream g("fact.out");
while((x<n*5) || (gasit==false)) {
z=zerouri(x);
if(z==n) {
gasit=true;
g<<x;
g.close();
return 0;
}
else if(z>n){
break;
} else {
x++;
}
}
if(gasit) {
g<<x;
} else {
g<<-1;
}
g.close();
return 0;
}