2024 Author: Malcolm Clapton | [email protected]. Last modified: 2023-12-17 03:44
Calculate how many trips you have to make to get to the desired floor.
Victor lives in a 20-storey building. The elevator at its entrance is out of order, so only two buttons work in the car. When you click on one of them, the elevator rises 13 floors, when you click on the other, it goes down to 8. How can Victor get from the 13th floor to the 8th floor to a friend?
The problem can be solved in different ways. Let's look at the classic way first.
The elevator cannot go beyond the boundaries of the floors. If Victor, being on the 13th floor, presses the "Up" button, the elevator will not reach the 26th floor, because there is simply no elevator in the house. It turns out that Victor will have to go down:
1. 13 − 8 = 5.
From the 5th floor he will only be able to go up, because there is no “minus 3” floor in the house either. This means that Victor can go up or down only if the number of floors allows it. That is, he always has one option, which button to press. You get the following travel history:
2. 5 + 13 = 18.
3. 18 − 8 = 10.
4. 10 − 8 = 2.
5. 2 + 13 = 15.
6. 15 − 8 = 7.
7. 7 + 13 = 20.
8. 20 − 8 = 12.
9. 12 − 8 = 4.
10. 4 + 13 = 17.
11. 17 − 8 = 9.
12. 9 − 8 = 1.
13. 1 + 13 = 14.
14. 14 − 8 = 6.
15. 6 + 13 = 19.
16. 19 − 8 = 11.
17. 11 − 8 = 3.
18. 3 + 13 = 16.
19. 16 − 8 = 8.
In 19 trips, Victor will finally reach the floor where his friend is waiting for him.
Now let's look at a more vital way.
Most often, the elevator reaches the top or bottom floor and stops, regardless of how many more floors it has to drive. Victor can take advantage of this and get to his friend faster. Here's how it would be:
1. 13 − 8 = 5.
2. 5 - 8 = 1 (the lift reached the 1st floor and stopped, it cannot go below).
3. 1 + 13 = 14.
4. 14 − 8 = 6.
5. 6 + 13 = 19.
6. 19 − 8 = 11.
7. 11 − 8 = 3.
8. 3 + 13 = 16.
9. 16 − 8 = 8.
Voila! Victor got to the right floor in 9 trips. Much better than 19!
Show answer Hide answer
The original problem can be viewed here.
Recommended:
15 bags and backpacks with unusual and strange designs from AliExpress
Unusual backpack with sponges, models in the form of toast, Winnie the Pooh or even a rainbow alien head - with such accessories you will definitely not be able to get lost in the crowd
How to do it right: put it down or lay it down
The life hacker studied the dictionaries and recommendations of academics and found out which option - to lay or lay down - is used by literate people
10 things long travels teach you
A long journey is always a new experience and life lessons. It is possible that it is for them that we go to distant countries and foreign cities
What Stephen King takes with him on his travels
Stephen King is unpretentious in choosing what he takes with him on a trip. However, the king of horrors cannot do without some things
25 original ideas for future travels
The most important thing is to come up with an amazing travel idea around which the route will be built. In this article, we will share examples of such ideas