- 1
Hi....does anyone have any idea how to solve the "Snail in the well" project for JavaScript?
3 Answers
+ 1
https://www.sololearn.com/discuss/2615972/?ref=app
https://www.sololearn.com/discuss/2618113/?ref=app
https://www.sololearn.com/discuss/2684031/?ref=app
https://www.sololearn.com/discuss/2617598/?ref=app
https://www.sololearn.com/discuss/2904293/?ref=app
https://www.sololearn.com/discuss/2624694/?ref=app
+ 1
function main() {
var depth = parseInt(readLine(), 10);
//your code goes here
var depthCover = 0;
for (day = 1; day<=depth; ++day){
if (depth - depthCover > 7){
depthCover += 5;
}else {
break;
}
}
console.log(day)
}
0
function main() {
var depth = parseInt(readLine(), 10);
//your code goes here
var climb = 7
var slip = 2
var days = 1
for (workdone = climb ;workdone < depth;days = days+1 ) {
if (workdone==depth) {
break;
}
workdone = workdone + climb;
workdone = workdone - slip;
}
console.log(days)
}