+ 4
Challenge 4
A monkey starts climbing up a pole. Each time it jumps 20 cm and then slips by 20%of the previous jump. Write a code to input the height of the pole and calculate how much time a monkey will take to reach to reach the top of the pole, if it takes 1 second to jump up and 0.5 second to slide down.
9 odpowiedzi
+ 4
finished...
https://code.sololearn.com/WJ3ptln71cCp/?ref=app
+ 9
Check: 50 cm pole = 20 cm (1s) - 4 cm (0.5s) + 20 cm (1s) - 4 cm (0.5s) + 18 cm (0.9s) = 3.9s.
Delete Line 7 if you want 4s as answer for 50 cm.
https://code.sololearn.com/Wp8I2vMkggl1/?ref=app
+ 5
I'm on it
+ 4
I had a similar question in Maths!
+ 2
Thanks @Amrit, waiting for your next brain teasing question.
+ 2
post a link @S Vengat
+ 1
lol = t => t < 20 ? 1 : Math.ceil((t-20)/16)*1.5 + 1
lol(42) // 4
+ 1
Just released the next one..
xD
- 1
this is my solution of python
https://code.sololearn.com/cVu65WFPADK5