+ 1

Help to decide the number 23 task fully)

function main() { var depth = parseInt(readLine(), 10); var days=0; var s=0; while (days<=depth){ days+=5; s+=1; } console.log(s); }

17th Aug 2021, 9:51 AM
Vladimir Kushner
Vladimir Kushner - avatar
5 Respostas
+ 2
The snail climbs up 7 feet each day and slips back 2 feet each night. You need to check the distance to depth and not days. And each time 5 must be not true.
17th Aug 2021, 10:44 AM
JaScript
JaScript - avatar
+ 2
„The snail climbs up 7 feet each day and slips back 2 feet each night“ that means you have two time points first before night and second after. For this reason you have to check the reached distance in the loop for the two sytuations. When dept is reached you can print the number of days, what is searched for here.
19th Aug 2021, 3:30 PM
JaScript
JaScript - avatar
+ 1
Ask, please, which I get started. Should I do to use boolean true/false conditionals to reach right answer?
19th Aug 2021, 12:47 PM
Vladimir Kushner
Vladimir Kushner - avatar
+ 1
You might want to reconsider the logic of your algorithm. Unless you want to see my solution.
19th Aug 2021, 2:54 PM
JaScript
JaScript - avatar
0
I'm not want to get solution right now, I 'd like to understand how to do this, to get something hints.
19th Aug 2021, 2:59 PM
Vladimir Kushner
Vladimir Kushner - avatar