+ 5
Snail in the well
Got the first two visible case couldnt solve the hidden cases My attempt https://code.sololearn.com/W6w4Iu3P2iLE/?ref=app
32 Respostas
+ 22
elvisreal , in fact you don't need to perform so complex calculations using slice, split, reverse and Math.floor method. Just follow the description. Don't just add 5 each day, because you should make a check if the length >= depth after increasing the length with 7. Look at the corrected code. Hope it helps you. 
https://code.sololearn.com/Wk4uxTS9bHaB/?ref=app
+ 10
It's very simple
TRY THIS 👇🏻
let day = 1;
for(let height = 7; height < depth; height += 5 ){
  day++;
}
console.log(day)
🥳🥳🥳🥳
+ 7
I solved this about 3 hours
So don’t just copy and paste the code next time, try also your best 
function main() {
    var depth = parseInt(readLine(), 10);
   var days = 0; seven = 7; two = 2; total = 0; isDone = false;
while(!isDone){
	total += seven;
	
	if(total >= depth){
		isDone = true;
	} else{
		
		total -= two;
	}
	
	days++;
	
}
    console.log(days);
}
+ 2
function main() {
    var depth = parseInt(readLine(), 10);
    //your code goes here
    day=0
    for (;depth>0;day++){
    	depth-=7
    	if(depth>0){
    		depth+=2
    	}
    }
    console.log(day)
}
+ 2
//the best solution
function main() {
    var depth = parseInt(readLine(), 10);
    //your code goes here
   var 
go = 7-2
   var dist = 0
   var day = 0
   for(let go =5; dist<=depth-3; dist +=go){
    day+=1
       
   }
    console.log(day)
}
+ 1
function main() {
    var depth = parseInt(readLine(), 10);
    //your code goes here
    var d=0;
    var i=0;
    for(i=0;d<depth;i++)
    {
        d=d+7;/*during day(d) it covers 7 feet*/
        if(d>=depth)/*the loop will break when it climbs the whole depth*/
        {
            i=i+1;/* here,i= no.of days*/
            break;
        }
        d=d-2;/*it slips down 2 feet at night*/
    }
    console.log(i);
}
+ 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;
            }
        }
    }
}
+ 1
function main() {
    var depth = parseInt(readLine(), 10);
    //your code goes here
    var i=0;
    var day=0;
    while(i<depth){
        day+=1;
        i+=7;
    //if the snail is already at the top by day it doesnt need to slip anymore at night
    if(i<depth){
        i-=2;
    }else{
        break;
    }
    }
    console.log(day);
}
+ 1
function main() {
    var depth = parseInt(readLine(), 10);
    //your code goes here
    console.log(Math.ceil((depth-2)/5));
    
}
+ 1
function main() {
    var depth = parseInt(readLine(), 10);
    //your code goes here
    var day = 0;
    var num = 0;
    if (depth>0)
    {
        do{
            num += 7;
            if (num==depth){
                continue;
            }
            else if(num<depth)
            {
                num-=2;
            }
            day++;
        }while (num<=depth);
    }
    console.log(day);
}
+ 1
console.log(Math.round(depth/5)) 
most efficient method
+ 1
 for(w=5; w <= w; w+=5){
     var work=w;
       console.log(Math.round(depth/work))
       {break;}
       
    }
}
The Math.round() function returns the value of a number rounded to the nearest integer.
is if 48 dethp/w = 8.4 eith math .round its 8 
0
In fact you don't even need a loop. You can get the answer with a single line of arithmetic operations. 
Hint: there is a linear relation between input and output
0
Jesse Franco Latosa thanks but i solved it my own way nice code tho
0
function main() {
    var x = parseInt(readLine(), 10);
    var y = 1;
    for (;;y++) {
        if ((y*5)>=(x-2)) {
            break;}
        }
        console.log(y);
    }
0
@Jesse Franco Latosa
 could you please explain the code?
0
function main() {
    var depth = parseInt(readLine(), 10);
    for(i=0;depth; i+7-5);
    
}
0
function main() {
    var depth = parseInt(readLine(), 10);
    //your code goes var 
//D is distance travel each day
var day=0;
for(D=0; D<depth; day++)
{	D+=7;
	if(D>=depth){
	 day++
	 break;
	}
	D-=2;
}
console.log(day)
}



