Pagini recente » Cod sursa (job #2777400) | Cod sursa (job #136155) | Cod sursa (job #2216329) | Cod sursa (job #640100) | Cod sursa (job #541286)
Cod sursa(job #541286)
#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++;
}
}
g<<-1;
g.close();
return 0;
}