šŸ“œ ā¬†ļø ā¬‡ļø

When there is nothing to drink

In the past few years, I regularly find myself in this situation: I still have to travel an hour, ten hours or a day to my destination, for some reason the statement from the title of the article was fulfilled, the window looks like in the photo below, but everything that could be spoken, already talked. In these cases, my university education comes in handy, and I recall the tasks that we once solved during breaks and the games we played in lectures. In this habrastia I will give a few tasks and games that will allow you to spend time on the train much more fun. The most difficult in this situation is that you need to remember the tasks that would be clear and interesting to everyone, so some cool math problems disappear. It's even harder to play games, firstly, they should also be interesting to everyone, and, secondly, you cannot play cool games like basketball or volleyball on the train.
Since there is another summer month ahead, then surely this habrapost will be useful to someone.




')
Mathematical and "mathematical" tasks

1. How to write the number 100 with the help of three twos and any signs of mathematical operations?
Answer
100 = āˆ’log 2 log 2 sqrt (sqrt (... sqrt (2) ...)), where instead of ... you need to write another 97 times the sign of the square root.

2. Take a chessboard and saw off A1 and H8 cells in it. Is it possible to pave the remaining field with ā€œdominoesā€ the size of 1 cell to 2 cells?
Answer
It is impossible, easy to come up with a suitable invariant.

3. Divide the circle into six sectors, write the sectors 1, 0, 1, 0, 0, 0. Allowed to add one to two adjacent numbers. Is it possible to make all the numbers the same?
Answer
It is impossible, easy to come up with a suitable invariant.

4. A cucumber is 90 percent water and a man 70 percent. By what percentage is a cucumber person?
Comment
I do not know how to solve this problem :) It seems to me that the condition is incorrect, so be it, the main thing is to have fun!

5. Three turtles crawling. The first one says: ā€œThere is no one in front of me, and behind me there are two turtlesā€. The second says: "There is one turtle in front of me and one turtle behind me." And the third says: "There is one turtle in front of me, one turtle behind me." How can this be?
Answer
One of the turtles is lying. The reaction of people at the moment when you tell them the correct answer is unpredictable.

6. How to cut a cake into 8 equal parts in three sections?
Comment
There are at least two solutions.

7. The plane flew 100 kilometers to the south, then 100 kilometers to the east, and then 100 kilometers to the north. As a result, the plane was at the starting point. Where could he fly from?
Comment
You can even fly around the pole several times.

8. A ladder is leaning against the wall. On the middle step of this staircase sits a fearless kitten. The staircase begins to ā€œmove outā€ so that one end touches the wall and the other floor. As a result, the stairs are on the floor. What is the path of the kitten?
Comment
That the answer is a piece of a circle, everyone guesses, but not everyone correctly guesses which way this piece will be convex.

9. There are five identical boxes, as well as a spoon, a match, an apple, a banana and a key. All items were distributed in boxes and asked 100 people to guess where everything lies. It turned out that 50 people did not correctly guess a single subject, 10 people correctly guessed one object, another 10 people correctly guessed two subjects, and 15 people correctly guessed three subjects. How many people correctly guessed four subjects, and how many people correctly guessed all five subjects?
Comment
Data is actually enough.

10, 11, ... More puzzles can be found in the recent ā€œ10 entertaining tasksā€ .

Programmer puzzles

If your company has programmers, then you can do the programming on a piece of paper.

1. Write a program that prints numbers from 1 to 10,000 without using any comparisons.
Comment
A program whose body consists of 10,000 printfs is not an elegant solution.

2. In the array of ints, all numbers except one are repeated twice. How can you find this single number for O (1) memory and O ( n ) operations?
Comment
Do not forget about XOR.

3. In the array of ints there is a number that occurs more than half of the time. How can I find this number in O (1) memory and in one pass through the array?
Answer
On HabrƩ there was an article "Search for frequently occurring elements in an array" about this task. This task seems difficult to me, but most of the people to whom I have set this task solved it.

4. Come up with a situation where the following code prints NO:
if (v == v) {
    std::cout << "YES";
} else {
    std::cout << "NO";
}

, v = NaN.

5, 6,ā€¦ .


1. , . , .

2. , , . : . . ā€” . , ā€” , , , . - , Ā«Ā», . . 8 . , .
. , .

3. ā€” . : , . . : . , , , , , . , .
, , . , , 2-5 .

-like

, . , , . : , : , , , . . , , - : Ā« Ā», : Ā« Ā». , - , : Ā« ?Ā» , . , . 10-15. , , ā€” , .
, . , Ā« Ā», - , .

, - , .

, , - , , . . , ? ( , - .)

Source: https://habr.com/ru/post/231361/


All Articles