- 1

Snail in the well

Try this function main() { var depth = parseInt(readLine(), 10); //your code goes h climb = 0; for(var days=1;;days++){ climb+=7; if(climb>=depth){ break; }climb-=2; } console.log(days); }

4th Sep 2021, 11:21 AM
Ranjay Kumar
3 ответов
+ 3
//Try this function main() { var depth = parseInt(readLine(), 10); console.log(Math.ceil((depth-2)/5)) }
4th Sep 2021, 12:00 PM
Simba
Simba - avatar
+ 1
mistake in for loop : 1. for ([initialExpression]; [conditionExpression]; [incrementExpression]) where is your condition 2. Call the function main()
4th Sep 2021, 11:37 AM
Pariket Thakur
Pariket Thakur - avatar
0
function main() { var depth = parseInt(readLine(), 10); //your code goes here var day=0; var i; for( i=0; day < depth; i++) { day += 7; if(day >= depth) { i += 1; break; } day -= 2; } console.log(i); }
8th Oct 2021, 8:55 PM
Ben
Ben - avatar