0
How to solve "snail in the wall" code coach?
Why my code doesn't pass all tests? My attempt : 👇👇 https://code.sololearn.com/cD5h9k1VCV22/?ref=app
2 Antworten
+ 4
console.log(Math.round(input/7-2));
+ 1
function main() {
var depth = parseInt(readLine(), 10);
//tu código va aquí
var d = 0; // días
var c = 0; // caracol
while (c < depth) {
c += 7 - 2;
d += 1;
if (c > depth) {
if (c - 2 <= depth) {
console.log(d);
break;
}
else if (c > depth) {
console.log(d - 1);
break;
}
}
}
}