Pagini recente » Diferente pentru problema/kdrum intre reviziile 20 si 13 | Cod sursa (job #1390411) | Cod sursa (job #139661) | Cod sursa (job #1098947) | Cod sursa (job #3139137)
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main(){
int x;
f >> x;
if (x == 0){
g << 1;
return 0;
}
int i = 1;
int nr = 0, cnt;
while(true){
++nr;
cnt = i;
while (cnt % 5 == 0) {
cnt /= 5;
++nr;
}
if (nr == x){
g << i * 5;
return 0;
}
else if (nr > x){
g << -1;
return 0;
}
++i;
}
return 0;
}